On Sat, Nov 26, 2005 at 09:27:57PM +0000, Tony Houghton wrote:
> 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).

There's your problem len should be 0x1000000 (ie. 16MB) when it gets 
subtracted from off. Somehow matroxfb first told you it has 16MB of 
video RAM and then when calling mmap() it thinks it has only 8MB.

You aren't playing some modprobe/rmmod game with matroxfb_crtc2 + 16MB 
card are you?

> 
> 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.

That's normal. First we map the RAM then the MMIO region.

-- 
Ville Syrjälä
[EMAIL PROTECTED]
http://www.sci.fi/~syrjala/

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

Reply via email to