In <[EMAIL PROTECTED]>, Ville Syrjälä wrote:

> On Fri, Nov 25, 2005 at 11:02:28PM +0000, Tony Houghton wrote:
> > I've got a strange problem with DirectFB on a Matrox G450, using TV out.
> > Sometimes DirectFBCreate fails with this error:
> > 
> > (!) DirectFB/FBDev: Could not mmap MMIO region (offset 0, length 16384)!
> >     --> Invalid argument
> 
> That error comes from the mmap() call. The kernel's fb_mmap() function 
> returns -EINVAL in quite a few places. Either the arguments of the 
> mmap() call are incorrect or var.accel_flags is not 0. offset and length 
> are correct in your case so either fix.smem_len and/or var.accel_flags 
> are somehow corrupted, or the kernel has gone mad, or maybe the error 
> comes from libc...
> 
> You could add printk()s to the fb_mmap() function in 
> drivers/video/fbmem.c.

Thanks. I've done that and eventually found that it fails the check:

  if ((vma->vm_end - vma->vm_start + off) > len)

(Example) values are:

  vm_end        = 0xb6d18000
  vm_start      = 0xb6d14000
  off           = 0x800000
  len           = 0x4000

Backtracking a bit, off gets its value from vma->vm_pgoff << PAGE_SHIFT.
vma->vm_pgoff is 0x1000 and off's initial value is therefore 0x1000000.

A bit later on len (which at that point is 0x800000) is subtracted from
off, giving its final value, and len gets reassigned from
PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len).

fb_mmap actually seems to get called twice. The first time vma->vm_pgoff
is 0 and everything is fine. When DirectFBCreate succeeds, vma->vm_pgoff
is 0x800 on the second call.

I don't know what the significance of this is, but I hope I've given you
enough information to work something out. This is with kernel 2.6.14.3,
but I've had the problem for months and months with older kernels; I
just never got round to joining the mailing list to report it etc until
now.

-- 
TH * http://www.realh.co.uk

_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to