How do I wait for vertical retrace?

Carsten Haitzler (The Rasterman) raster at rasterman.com
Thu May 8 18:14:38 PDT 2008


On Fri, 9 May 2008 02:08:26 +0100 Glynn Clements <glynn at gclements.plus.com>
babbled:

> 
> 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.

it will preempt :)

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




More information about the xorg mailing list