Page flipping / Double buffering


4 posts
by aaa801 » Tue Jan 15, 2013 10:14 pm
Has anyone managed to implement page flipping / double buffering in the bcm 2708 fb driver?
Posts: 423
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire
by -rst- » Fri Jan 25, 2013 12:09 pm
I took a stab at this a while ago - unfortunately I have no previous experience in kernel/driver development and did not get really anywhere with setting up the build environment - not enough time or not enough drive to take the time... :oops:

It definitely looks like doable using the mailbox iface 'Set virtual (buffer) width/height' and 'Set virtual offset'... Dom 'almost promised' to 'look into' it viewtopic.php?f=67&t=19073&p=231080#p231058 :roll:

(Guess everyone reading this sub-forum knows these already... https://github.com/raspberrypi/firmware ... -interface and https://github.com/raspberrypi/linux/bl ... m2708_fb.c)
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
Posts: 895
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland
by -rst- » Fri Apr 05, 2013 11:28 am
Some more info on this viewtopic.php?f=67&t=19073&p=324866#p324866 ...looks like this would be trivial and would be even vsync'ed 'for free'...
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
Posts: 895
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland
by cleverca22 » Sat Apr 13, 2013 6:14 am
(i havent checked the posts linked above)

from the testing ive done under android, the normal framebuffer calls to do page flipping appear to just work on the raspberrypi fork of android

(dumbed down example with no error checking)
Code: Select all
ioctl(fd, FBIOGET_VSCREENINFO, &info); // get defaults from kernel (edid prefered?)
info.yres_virtual = info.yres * 2; // request a virtual framebuffer twice as tall
ioctl(fd, FBIOPUT_VSCREENINFO, &info); // store the changes back into kernel config


and then to flip pages
Code: Select all
info.activate = FB_ACTIVATE_VBL; // apply at vsync maybe???
info.yoffset = offset; // set the offset to scroll to (scroll down by 1 screen-height to flip the pages)
ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO,info); // inform the driver
Posts: 167
Joined: Sat Aug 18, 2012 2:33 pm