Hello,
I would like to describe an apparently simple project and ask people
on this list if they believe there is a way to achieve it with SDL
(under linux). In a nutshell, I wonder if it is possible to get control
of display duration down to the screen refresh rate.
I want to display at a fast rate a series of pictures on the screen,
and collect mouse clicks timestamped with the best possible accuracy.
Some pictures should remain on the screen for as little as 2 or 3 refresh
cycles (~30, 45 msec, depending on the Vertical Sync Freq).
Actually I need to have a total control on the number of refresh cycles
a picture is displayed.
The user is instructed to click on one the mouse’s buttons when
he/she detects a pretermined target picture in the continous stream of
pictures… At the end, I want to know precisely when the clicks occured.
At such a fast rate, the user will not see consciously some of the
pictures, but this is precisely what I am interested in (his visual system
may have registered them, in a sort of subliminal perception if you like)
Long ago, I wrote a DOS program in Borland Pascal that does just that:
do
wait for the specified number of vertical retrace synchro signal
swap hidden and visual page
prepare next picture in the hidden page
loop
It worked well, but the only (big) proble is that the 10 years old Borland
BGI drivers only knows about plain VGA video mode…
The problem is much more complex under linux, it seems to me, because
of the multitasking OS:
How can I be sure not to miss a vertical retrace signal? (i.e. how can I
be sure that my process is going to be running at this critical moments?)
Plus the granularity of the typical timing functions seems to be around 10
msec.
Any idea?
Cheers,
Christophe Pallier