How do I wait for vertical retrace?

Carsten Haitzler (The Rasterman) raster at rasterman.com
Tue May 6 05:00:23 PDT 2008


On Tue, 6 May 2008 13:36:23 +0200 "Johan Walles" <johan.walles at gmail.com>
babbled:

> 2008/5/6 Michel Dänzer <michel at tungstengraphics.com>:
> > On Tue, 2008-05-06 at 13:12 +0200, Johan Walles wrote:
> >  > 2008/5/6 Samuel Thibault <samuel.thibault at ens-lyon.org>:
> >  > > Michel Dänzer, le Tue 06 May 2008 09:37:23 +0200, a écrit :
> >  > > > On Mon, 2008-05-05 at 15:43 +0100, Samuel Thibault wrote:
> >  > >  > > Michel Dänzer, le Mon 05 May 2008 10:22:19 +0200, a écrit :
> >  > >  > > > On Sun, 2008-05-04 at 20:06 +0200, Johan Walles wrote:
> >  > >  > > > >
> >  > >  > > > > I would like to wait for vertical retrace in an X
> >  > >  > > > > application.  How can I do that?
> >  > >  > > > >
> >  > >  > > > > The point would be to avoid flicker in my app by using double
> >  > >  > > > > buffering and update the on-screen image during vertical
> >  > >  > > > > retrace.
> >  > >  > > >
> >  > >  > > > There's no mechanism for this yet in X. Your best bet is
> >  > >  > > > probably to use OpenGL, e.g. the GLX_SGI_swap_control extension.
> >  > >  > >
> >  > >  > > Isn't there a more simple double buffering X extension?
> >  > >  >
> >  > >  > You mean DOUBLE-BUFFER?
> >  > >
> >  > >  Yes.
> >  > >
> >  > >  > I'm not really familiar with it, but I know that
> >  > >  > at this time it can't synchronize buffer swaps to the refresh.
> >  > >
> >  > >  Eww, that would be a pity.  At the very beginning of the Extension
> >  > >  documentation (Johan: xspecs/Xext/buffer.PS), it is said `Clients
> >  > > should be able to [...] Display a series of buffers in a window in
> >  > > rapid succession to achieve a /smooth/ animation', which is what Johan
> >  > > wants to eventually achieve AIUI (vertical retrace wait being only one
> >  > > method, I don't know whether which others could be possible).
> >  >
> >  > I don't care about vertical retrace in itself, waiting for vertical
> >  > retrace would only be a way for me to achieve flicker-free animation
> >  > in a 2D application.  Any other way of doing that would be fine as
> >  > well.
> >
> >  I think the standard technique for double buffering is to use a pixmap
> >  as the 'back buffer'.
> 
> How would that help achieving flicker-free animation if it doesn't
> wait for vertical retrace?

it is flicker free... just not tear-free :)

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com




More information about the xorg mailing list