Re: virtual frame buffer

"Antonino A. Daplas" <[email protected]> Fri, 14 Oct 2005 21:04:09 +0800
Newsgroups gmane.linux.fbdev.user
Message-ID <[email protected]>
Yan Seiner wrote:
> 
>> Vfb behaves like a real frame buffer device, except that you cannot
>> mmap() it
>> to userspace (resulting behavior is undefined). But that should be
>> fixable by
>> letting vfb provide its own fb_mmap() routine, if anyone cares to
>> implement.
>>
>> Gr{oetje,eeting}s,
>>
>>                         Geert
>>  
>>
> Well, that explains why vncserver won't work right.  It gives me hope
> that everything else I've done works.
> 
> OK, I've had a look at the various kernel source xxfb_mmap functions... 
> If I were to try and write one for the vfb, where do I find some docs or
> info on where to start?
> 
> And/or what's the closest one I can copy from driver/video?  Is there
> one that is simple and well documented which explains what xxfb_mmap is
> supposed to do and how?
> 

You can start by changing vfb to use __get_free_pages() to allocate the
videomemory instead of vmalloc.

Then just copy the fb_mmap() function in drivers/video/fbmem.c to
vfb.c as vfb_mmap and then mark vm->vm_flags as VM_RESERVED also. Then make sure that
you point fb_mmap in vfb_ops to your vfb_mmap() function.

If you're using linux-2.6, you also have to add this before register_framebuffer():

info->fix.smem_len = videomemorysize;
info->fix.smem_start = virt_to_phys(videomemory) & PAGE_MASK;

Tony




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl