LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Frame Buffer Programming - Need Documentation (https://www.linuxquestions.org/questions/programming-9/frame-buffer-programming-need-documentation-513838/)

qwijibow 12-26-2006 02:03 PM

Frame Buffer Programming - Need Documentation
 
Hello guys.

Hey Guys, Im working on a 2d Game Engine for embedded x86 Linux.
As size and efficiant use of resources is extrememly important, i have decided to use the vesafb frame buffer via its block device /dev/fb

excluding the need to X, SDL, or DirectFB.

Its currently in very early development - ( works my mmap'ing /dev/fb0, then memcpy'ing pixels line by line.

This is all working very nicely, except for the opviouse faults...

* Occasional Flickering...
* std-output overwriting the graphics.
* Blinking Cursor flickering in the top corner.

I need to know.....

1) How to page flip ( double buffering )
2) How to wait for Verticle sync
3) How to prevent Linux From writing text to the fbdev that im using.
4) What kernel source files provide the /dev/fb0 block device interface.

I Assume that the first two are done with ioctl's
However i cannot find any odumentation on how.

and i have no diea what so ever about how to implement number 3.

i have read the vesafb.c source code, however this does not appear to be the kernel source code that provides the /dev/fb0 block device, and so offers no information on ioctl codes.

Im affraid that i have never programmed outside of the X11 environment.. and so am a little lost at this level.

What doesnt help, is that most how-to's about frame buffers under linux were written a very long time ago, in the days of kernel 2.0.

Anyways... Thanks for any help / advice / links / code anyone can provide.

orhun 12-27-2006 01:03 PM

Hi,
I thought this might help www.mesa3d.org/glfbdev-driver.html.

phantomfive 12-10-2010 07:45 PM

Did you figure this out? I'm currently trying something similar.

Phredog 08-07-2012 02:29 PM

struct fb_fix_screeninfo fix;
struct fb_var_screeninfo var;
int DisplayIdx; //0=Buffer 0 1=Buffer 1
int dummy=0;
unsigned int FbSize;

if(ioctl(Fh_frbuff,FBIO_WAITFORVSYNC,&dummy)!=-1)
{
//Error
}
//Ok, now we are in the vertical retrace

//Get the video into
ioctl(Fh_frbuff,FBIOGET_FSCREENINFO,&fix); //Fixed info
ioctl(Fh_frbuff,FBIOGET_VSCREENINFO,&var); //Variable info
FbSize=(var.xres*var.yres*var.bits_per_pixel)/8; //Get buffer size
var.yoffset=var.yres*DisplayIdx; //Pan the display to buffer 1

Good luck


All times are GMT -5. The time now is 01:22 AM.