How do I wait for vertical retrace?

Glynn Clements glynn at gclements.plus.com
Thu May 8 18:08:26 PDT 2008


Samuel Thibault 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.
> > >
> > >   
> > Without the signal from the hardware you cannot avoid tearing. We tried 
> > using
> > OS timer to get smooth animation and it does not work very well on 
> > Linux.
> 
> Maybe that's because your linux had a fixed-frequency RTC set to 100Hz ?
> (thus not precise enough).

Right. But with 100Hz scheduling granularity, just using the vblank
signal won't help unless the kernel preempts the current process when
vsync occurs. If you wait for the current time-slice to expire, the
vertical blanking period will be over before your code runs.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list