OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 9:39 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Page flipping in vbe
PostPosted: Thu Jun 10, 2010 6:01 am 
Offline
Member
Member
User avatar

Joined: Wed Nov 07, 2007 12:15 pm
Posts: 226
Location: Italy
Is it possible to use page flipping (ping-pong buffering) which works like this: http://en.wikipedia.org/wiki/Multiple_buffering#Page_Flipping.
Suppose I have two buffers:
One at 0xE0000000 (the typical vesa frame buffer)
Another created using malloc (my back buffer).

Instead of rendering the back buffer and then copying it to the front one, i'd like to change the frame buffer pointer to point to the back buffer, then rendering on the old front buffer, and switch again.
Can this be done in Vesa VBE?

_________________
Please, correct my English...
Motherboard: ASUS Rampage II Extreme
CPU: Core i7 950 @ 3.06 GHz OC at 3.6 GHz
RAM: 4 GB 1600 MHz DDR3
Video: nVidia GeForce 210 GTS... it sucks...


Top
 Profile  
 
 Post subject: Re: Page flipping in vbe
PostPosted: Thu Jun 10, 2010 1:32 pm 
Offline
Member
Member

Joined: Sat Jan 23, 2010 2:56 pm
Posts: 123
To have double-buffering, both buffers must be in video memory; although the buffer pointer can usually be changed, it must stay within vram and not into main memory (because the video card only even touches vram - you have to manage moving data between that and main memory. Depending on the exact graphics card, this may not be true (think integrated graphics which only have main memory to use), but in general it is)

Anyway, there's already a thread about this, which explains everything else.


Top
 Profile  
 
 Post subject: Re: Page flipping in vbe
PostPosted: Thu Jun 10, 2010 2:04 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 24, 2009 8:11 pm
Posts: 1249
Location: Sunnyvale, California
@selenic: Actually, I don't think that thread really answers the OP's question. His question is about how to change the pointer to the current framebuffer for a VBE mode. Unfortunately, I don't know the answer either.

Also, double buffering != page flipping.


Top
 Profile  
 
 Post subject: Re: Page flipping in vbe
PostPosted: Thu Jun 10, 2010 3:10 pm 
Offline
Member
Member

Joined: Sat Sep 29, 2007 5:43 pm
Posts: 127
Location: Amsterdam, The Netherlands
AlfaOmega08 wrote:
Is it possible to use page flipping (ping-pong buffering) which works like this: http://en.wikipedia.org/wiki/Multiple_buffering#Page_Flipping.
Suppose I have two buffers:
One at 0xE0000000 (the typical vesa frame buffer)
Another created using malloc (my back buffer).

Instead of rendering the back buffer and then copying it to the front one, i'd like to change the frame buffer pointer to point to the back buffer, then rendering on the old front buffer, and switch again.
Can this be done in Vesa VBE?

Should be possible with AX=4F07h, BL=00h; AX=4F07h, BL=02h (encouraged); AX=4F07, BL=80h and AX=4F07, BL=82h (encouraged). AX=4F07h or function 07h is used to get and set the display start. BL=00h is used to set the display start, BL=02h is used to schedule a display start, BL=80h is used to set the display start during vertical retrace, BL=82h is the same as 80h but an alternative function. BH should be equal to 00h when using these functions. Other than that: ECX should be the display start address in bytes in case of BL=02h and BL=82h. In case of BL=00h and BL=80h CX is the first displayed pixel in the scan line and DX is the first displayed scan line. When the function is called you'll get the return status in AX.

The reason why functions 02h and 82h are encouraged is because they allow correct page flipping in all colour depths, whilst functions 00h and 80h might have issues in the 24bpp modes where three bytes are used to represent a pixel. That might cause problems when using some (x,y) start addresses since a given combination might not work.

The problem with using 02h and 82h is that they only exist in VBE 3.0 (afaik), whilst 00h exists since VBE 1.2 and 80h since VBE 2.0.


Regards,
Stephan J.R. van Schaik.


Top
 Profile  
 
 Post subject: Re: Page flipping in vbe
PostPosted: Thu Jun 10, 2010 3:25 pm 
Offline
Member
Member

Joined: Sat Jan 23, 2010 2:56 pm
Posts: 123
NickJohnson wrote:
@selenic: Actually, I don't think that thread really answers the OP's question. His question is about how to change the pointer to the current framebuffer for a VBE mode. Unfortunately, I don't know the answer either.

Hmm, I suppose not, actually. Nonetheless, it's a related thread, so it may still be of help.

NickJohnson wrote:
Also, double buffering != page flipping.

That's a terminology fail on my part. I thought they meant the same thing, but now I see that they don't. My point about not being able to have one page in memory still stands, as does the comment about having to send most modifications to vram twice (for the two different buffers) if you don't have a hardware blitter available.

Speaking of hardware blitters, this from Wikipedia looks promising:

Wikipedia wrote:
VBE/AF provides a low-level, standard interface to common acceleration functions available on most hardware. Some of the functions supported in the standard are access to hardware cursors, Bit Block Transfers (Bit Blt) , off screen sprites, hardware panning, drawing and other functions.


Top
 Profile  
 
 Post subject: Re: Page flipping in vbe
PostPosted: Thu Jun 10, 2010 3:51 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
For the record, VBE/AF is practically nonexistant.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 115 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group