[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xine debs



On  22 Apr, this message from Benjamin Herrenschmidt echoed through cyberspace:
>>Other point: performance. I am getting around 70 dropped frames out of
>>each block of 200... Which makes DVD useable, but impossible to really
>>_watch_ a movie. What are others getting? This is on a G4/400 TiBook.
>>Has anybody made any atttempt at using Altivec to speed things up?
> 
> I'm pretty sure most of the performance problem is not due to decoding
> but to PCI throughput in Xv. This could probably be improved either by
> using bust mastering within Xv (using DRI) but that would be quite
> complicated, or by figuring out a way for Xv to map the YUV overlay
> buffer write-through cacheable.

How about the attached patch then? It adds an mmap() operation to
aty128fb, thus X maps the framebuffer writethru:

aty128fb: Mapping uncached: start=a0000000, len=8192.
aty128fb: Mapping uncached: start=a0000000, len=8192.
aty128fb: Mapping uncached: start=a0000000, len=8192.
aty128fb: Mapping WriteThru: start=a4000000, len=8388608.
VFS: Disk change detected on device ide1(22,0)
     ^^^^^^^^^^^
This is the DVD drive ;-)

I.e. X has one mmap() on the framebuffer, and that one is set writethru.
But performance in xine doesn't improve :( still have ~70 out of 200
frames dropped.

So I guess we need to look at other solutions... Note that while playing
a DVD, top shows one xine process consuming around 70% CPU (video
decoder?), X has 15-20%, and two other xine processes consume around 5%
each.

Patch for mmap is attached (against recent benh 2.4 kernels).

Cheers

Michel

-----------------------------------------------------------------------
Michel Lanners                 |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes            |    Ask Questions.  Make Mistakes.
L-1710 Luxembourg              |
email   mlan@cpu.lu            |
http://www.cpu.lu/~mlan        |                     Learn Always. "
--- linux-2.4.benh-244pre1/drivers/video/aty128fb.c	Thu Apr 12 20:27:03 2001
+++ linux-2.4.benh/drivers/video/aty128fb.c	Mon Apr 23 13:17:19 2001
@@ -351,6 +351,8 @@
 static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
 		       u_long arg, int con, struct fb_info *info);
 static int aty128fb_rasterimg(struct fb_info *info, int start);
+static int aty128fb_mmap(struct fb_info *info, struct file *file,
+			struct vm_area_struct *vma);
 
 
     /*
@@ -443,6 +445,7 @@
 	fb_pan_display:	aty128fb_pan_display,
 	fb_ioctl:	aty128fb_ioctl,
 	fb_rasterimg:	aty128fb_rasterimg,
+	fb_mmap:	aty128fb_mmap,
 };
 
 #ifdef CONFIG_PMAC_BACKLIGHT
@@ -1693,6 +1696,53 @@
 }
 
 
+/* Private mmap since we want to have a different caching on the framebuffer
+ * for aty128fb.
+ * Note there's no locking in here; it's done in fb_mmap() in fbmem.c.
+ */
+static int aty128fb_mmap(struct fb_info *info, struct file *file,
+			 struct vm_area_struct *vma)
+{
+	struct fb_ops *fb = info->fbops;
+	struct fb_fix_screeninfo fix;
+	struct fb_var_screeninfo var;
+	unsigned long off, start;
+	u32 len;
+
+	fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
+	off = vma->vm_pgoff << PAGE_SHIFT;
+
+	/* frame buffer memory */
+	start = fix.smem_start;
+	len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.smem_len);
+	if (off >= len) {
+		/* memory mapped io */
+		off -= len;
+		fb->fb_get_var(&var, PROC_CONSOLE(info), info);
+		if (var.accel_flags)
+			return -EINVAL;
+		start = fix.mmio_start;
+		len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.mmio_len);
+		pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
+		printk("aty128fb: Mapping uncached: start=%lp, len=%d.\n", start, len);
+	} else {
+		/* framebuffer */
+		pgprot_val(vma->vm_page_prot) |= _PAGE_WRITETHRU;
+		printk("aty128fb: Mapping WriteThru: start=%lp, len=%d.\n", start, len);
+	}
+	start &= PAGE_MASK;
+	if ((vma->vm_end - vma->vm_start + off) > len)
+		return -EINVAL;
+	off += start;
+	vma->vm_pgoff = off >> PAGE_SHIFT;
+	if (io_remap_page_range(vma->vm_start, off,
+	    vma->vm_end - vma->vm_start, vma->vm_page_prot))
+		return -EAGAIN;
+
+	return 0;
+}
+
+
 #ifndef MODULE
 int __init
 aty128fb_setup(char *options)

Reply to: