[SDL] Precise behavior of SDL_flip() and hardware buffers.
Bob Pendleton
bob at pendleton.com
Thu May 22 05:16:04 PDT 2003
On Thu, 2003-05-22 at 00:20, Sam Lantinga wrote:
> > The documentation for SDL_Flip() (http://sdldoc.csn.ul.ie/sdlflip.php)
> > states:
>
> > > On hardware that supports double-buffering, this function sets up a
> > > flip and returns. The hardware will wait for vertical retrace, and
> > > then swap video buffers before the next video surface blit or lock
> > > will return.
>
> > To me that means that the call returns immediately but the next action
> > that locks the buffer will be forced to wait until after the next
> > vertical retrace before the lock can complete. But, when I test this
> > function on my machine I see that SDL_Flip() does not return
> > immediately. It appears to return after the next vertical retrace. My
> > guess is that the documentation is correct for some platforms and wrong
> > for others. My guess is that depending on the platform the actual
> > behavior of SDL_Flip() is *all* of the following:
>
> > 1) The display pointer changes immediately, you may get tearing,
> > SDL_Flip() returns instantly.
>
> > 2) The flip takes place at the next video retrace, but SDL_Flip()
> > returns immediately. Possibly returning before the flip has happened.
>
> > 3) The Flip takes place at the next video retrace, and SDL_Flip()
> > returns after the flip has happened.
>
> > Can someone please confirm or deny my guesses? To write portable code it
> > is necessary to know all the different ways that SDL_Flip() behaves.
>
> I believe this is correct. Whenever possible I've tried to implement #2.
> What is always true is that the next surface lock after a flip will return
> after the current framebuffer has been displayed to the end user, and if
> vertical retrace sync is available, after the vertical retrace.
>
> See ya,
> -Sam Lantinga, Software Engineer, Blizzard Entertainment
Thanks Sam, that is the information I needed.
Bob Pendleton
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
--
+-----------------------------------+
+ Bob Pendleton: independent writer +
+ and programmer. +
+ email: Bob at Pendleton.com +
+-----------------------------------+
More information about the SDL
mailing list