How do I wait for vertical retrace?

Doug Larrick doug at parkercat.org
Mon May 5 08:04:59 PDT 2008


Johan Walles wrote:
> Hi!
>
> 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.
>
> I've been trying to Google this without any luck so far.  Help!

You can use DRM's drm_wait_vblank ioctl, or OpenGL's GLX_SGI_video_sync
extension, to wait for vblank.  Neither of these work on all hardware. 
MythTV, for example, tries both before falling back to non-vblank-synced
timing methods.  Also, recent versions of at least the Intel driver
require an active, visible OpenGL drawable in order for the interrupt
supporting both these methods to fire at all -- this was evidently a
power-saving change.

-Doug




More information about the xorg mailing list