How do I wait for vertical retrace?
Carsten Haitzler (The Rasterman)
raster at rasterman.com
Tue May 6 19:10:18 PDT 2008
On Wed, 7 May 2008 02:59:25 +0100 Glynn Clements <glynn at gclements.plus.com>
babbled:
>
> Carsten Haitzler (The Rasterman) wrote:
>
> > so this is how to do it. as such we really could do with a standard 2d vsync
> > signal from x that is reliable and works the vast majority of the time and
> > doesn't involve anyone sitting and polling/spinning. :) i can dream... :)
>
> A "signal" implies a reverse round-trip (i.e. the server notifies the
> client at the start of the vertical blank, and the client has to get
> the response back to the server before the blanking period is over),
> which is undesirable, particularly for non-local clients.
yup. a "vsync" event would b a godsend. personally - if you are not local...
don't use this method. give up. the real reason for this is to make a vsync fps
limited composite manager. so the composite manager will limit screen upates to
X frames per seconds - irrespective of what client apps actually redraw at, AND
also force updats to be synced to vblank. a composite manager that isn't local
is going to be pretty nasty anyway.
> In most cases, it would be better to have a mechanism to tell the
> server to delay execution until the beginning of the next blanking
> interval. Actually, delaying execution until the refresh passes a
> certain scan line (i.e. the bottom of the modified region) would be
> better, as that allows more time.
i'd even much prefer that. then with a little tuning the app can figure out
its latency. i.e. i have 1600x1200. i do some tuning and know that if i get an
interrupt on scanline 930, i can get the "line 930 reached" event, respond and
copy from a backbuffer to the screen by the time vblank (line 0) gets hit. as
copies work down the screen (normally) the final writes to the bottom of the
screen will not be an issue as scanning has passed by there by the time i write
to it.
wonderful... in theory. in practice a lot of hardware ONLY provides a vblank
interrupt. no interrupt for line X. :(
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 :(
> --
> Glynn Clements <glynn at gclements.plus.com>
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
>
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) raster at rasterman.com
More information about the xorg
mailing list