How do I wait for vertical retrace?

Glynn Clements glynn at
Wed May 7 14:55:42 PDT 2008

Carsten Haitzler (The Rasterman) wrote:

> wonderful... in theory. in practice a lot of hardware ONLY provides a vblank
> interrupt. no interrupt for line X. :(

You don't need the signal to come directly from the video hardware. If
you know your clock frequencies, you can use the OS' timers; you just
need to phase-lock to vsync to prevent drift.

> so as such i'd rather just have this work for a local client - be able to get
> the vblank (or line 0 reached) event then respond asap. for remote clients -
> game over anyway :(

If you insist on using a reverse round-trip through the client, then
it's definitely game over for non-local clients (or maybe even local
clients if you don't have sufficiently low latency).

But there are better ways to implement synchronised rendering, i.e. 
making the server perform the synchronisation. One option would be to
suspend execution of any requests between XdbeBeginIdiom() and
XdbeEndIdiom() until vsync (or until the raster passes the lowest line
affected by any of the commands).

Glynn Clements <glynn at>

More information about the xorg mailing list