Vertical retrace count

Hi all,

is there a way to count the vertical retraces? I haven?t found a
function, which waits for a vertical retrcace. SDL (1.1.6) runs on a
Linux box with Xfree 401.

Thanks, Sven

Hi all,

is there a way to count the vertical retraces? I haven?t found a
function, which waits for a vertical retrcace. SDL (1.1.6) runs on a
Linux box with Xfree 401.

Nope, often that information isn’t available from the underlying video
driver.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

is there a way to count the vertical retraces? I haven?t found a
function, which waits for a vertical retrcace. SDL (1.1.6) runs on a
Linux box with Xfree 401.

Not yet, but some kind of retrace detection should be added in the future
since it is generally useful (triple buffering etc).

What do you need it for? SDL might have another way of doing what you
are trying to accomplish

Thu, 30 Nov 2000 Sven Garbade wrote:

Hi all,

is there a way to count the vertical retraces? I haven?t found a
function, which waits for a vertical retrcace. SDL (1.1.6) runs on a
Linux box with Xfree 401.

SDL_Flip() (or SDL_LockSurface() on some targets, IIRC) does a retrace sync on
the targets that support it.

Unfortunately, there’s generally no way to get some kind of signals or events
from the drivers, so busy-waiting is often the only option. Some hardware
doesn’t provide IRQs, and some drivers don’t provide any means of raster sync
at all… Anyway, SDL deals with these details, so all you do is hope that your
favourite target has raster sync support. :slight_smile:

//David

Uhm, BTW, in case anyone has been looking at it, MuCoS is to be renamed “MAIA”;
the Multimedia Application Integration Architecture. Looks and sounds better,
but it’s still the same project with the same goals, except that it’s slightly
more software than vapourware now. Think VST 2.0 integrated with ReWire, add
support for other data types than audio, and then smack an LGPL sticker on
that, and you get the idea.
|
V
…- M u C o S -------------------------. .- David Olofson --------.
| A Free/Open Source | | Audio Hacker |
| Plugin and Integration Standard | | Linux Advocate |
| for | | Open Source Advocate |
| Professional and Consumer | | Singer |
| Multimedia | | Songwriter |
-----> http://www.linuxdj.com/mucos -'—> david at linuxdj.com -’

Thu, 30 Nov 2000 Sam Lantinga wrote:

Hi all,

is there a way to count the vertical retraces? I haven?t found a
function, which waits for a vertical retrcace. SDL (1.1.6) runs on a
Linux box with Xfree 401.

Nope, often that information isn’t available from the underlying video
driver.

Well, you could count loops in the main loop, as long as the target supports
synced flips, right?

However, to do it in any reliable way, you’d either need a special hardware
counter (which doesn’t exist on any hardware, AFAIK) and/or a hard RT kernel
and a suitable driver.

The problem is that many cards (and thus most drivers) only provide
busy-waiting methods of detecting the vertical retrace, which means that it’s
very hard to implement reliable retrace sync or counting.

Another, related problem is that you can’t select video refresh rates without
restrictions, meaning that you can’t design games to run hard-synced to the
retrace at a specific rate. This is the same problem as console developers face
when porting between PAL (50 Hz) and NTSC (60 Hz), only a lot worse, as you
have to deal with it dynamically, when installing the game, or later. Include
animations and control scripts tuned for the “standard” rates 60, 70, 75, 85
and 90 Hz with every game? heh…

One could play with the modelines on some targets, but I’m worried about how
plug’n’play that method is… Any experiences or ideas in that area? Would it
be feasible to add some kind of refresh rate manager to SDL? (This would be
possible to implement on most targets I know about, although not always in nice
and clean ways. That’s why I’d prefer to view it as a part of the system
configuration rather than something that every single 2D game has to mess with
in it’s own ways.)

Anyway, I’m going the OpenGL way, which means that I get sub-pixel acurate
scrolling and sprite positioning with h/w acceleration. Once being an Amiga
guy used to ultra smooth PAL/NTSC tuned games, that’s the only way I can see
of providing acceptable smoothness on standard PC hardware. It does require
higher screen resolution/graphics detail to avoid interferece effects (similar
to what you get in 3D w/o mipmapping), but that’s hardly a problem these days.

“Code talks”, I hear…

Yeah, and I’m working on it (“generic” 2D API for heavy scrolling games, frame
rate/refresh rate management etc), although progress is very slow, due to the
MAIA project (former MuCoS) having higher priority right now. Have to get it
off the ground, as people are at the point of really needing it… (The
community has one plugin API of it’s own already; LADSPA, but it covers only
VST 1.0 functonalit. We need to cover the VST 2.0 extensions and ReWire as
well.)

//David

…- M u C o S -------------------------. .- David Olofson --------.
| A Free/Open Source | | Audio Hacker |
| Plugin and Integration Standard | | Linux Advocate |
| for | | Open Source Advocate |
| Professional and Consumer | | Singer |
| Multimedia | | Songwriter |
-----> http://www.linuxdj.com/mucos -'—> david at linuxdj.com -’

Mattias Engdeg?rd wrote:

is there a way to count the vertical retraces? I haven?t found a
function, which waits for a vertical retrcace. SDL (1.1.6) runs on a
Linux box with Xfree 401.

Not yet, but some kind of retrace detection should be added in the future
since it is generally useful (triple buffering etc).

What do you need it for? SDL might have another way of doing what you
are trying to accomplish

We need this for briefly stimulus presentations in our
psychophysics-lab. The idea is, to count the vertical retraces to
control the presentation time of a stimulus. E.g. the monitor runs with
(almost) exact 100Hz vf and the stimulus should be presented 80 msc, so
this time period corresponds (lasts) with 8 vertical retraces.

What do you need it for? SDL might have another way of doing what you
are trying to accomplish

We need this for briefly stimulus presentations in our
psychophysics-lab. The idea is, to count the vertical retraces to
control the presentation time of a stimulus. E.g. the monitor runs with
(almost) exact 100Hz vf and the stimulus should be presented 80 msc, so
this time period corresponds (lasts) with 8 vertical retraces.

You probably need a custom application that works with DGA (on Linux)
or DirectX (on Windows) with specific hardware that will allow you to
count the vertical retraces.

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

We need this for briefly stimulus presentations in our
psychophysics-lab. The idea is, to count the vertical retraces to
control the presentation time of a stimulus. E.g. the monitor runs with
(almost) exact 100Hz vf and the stimulus should be presented 80 msc, so
this time period corresponds (lasts) with 8 vertical retraces.

No problem. Make sure you have a display target with page flipping
capabilities, and spin with SDL_Flip() in a loop. Count the flips.
As long as you only need static images, this should be possible even
on quite slow hardware

Mattias Engdeg?rd wrote:

No problem. Make sure you have a display target with page flipping
capabilities, and spin with SDL_Flip() in a loop. Count the flips.
As long as you only need static images, this should be possible even
on quite slow hardware

Ah, nice idea, thanks. And Sam, do you have any idea where to ask for
these graphic cards?

Thanks, Sven

Mattias Engdeg?rd wrote:

No problem. Make sure you have a display target with page flipping
capabilities, and spin with SDL_Flip() in a loop. Count the flips.
As long as you only need static images, this should be possible even
on quite slow hardware

Ah, nice idea, thanks. And Sam, do you have any idea where to ask for
these graphic cards?

Make sure that you have XFree86 4.01 or newer, run the program as root,
set the environment variable SDL_VIDEODRIVER=dga, and use a card like:
Voodoo3, Matrox G400, … any other card with a decent DGA driver.

You can also use the framebuffer console with Linux 2.4 and the Voodoo 3
and Matrox Millennium or G400.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

…which is a pretty fast and solid solution for software rendering,
BTW. (On my machine, at least: P-III 933 + G400.)

//David

.- M u C o S -------------------------. .- David Olofson --------.
| A Free/Open Source | | Audio Hacker |
| Plugin and Integration Standard | | Linux Advocate |
| for | | Open Source Advocate |
| Professional and Consumer | | Singer |
| Multimedia | | Songwriter |
-----> http://www.linuxdj.com/mucos -'—> david at linuxdj.com -'On Friday 01 December 2000 21:00, Sam Lantinga wrote:

You can also use the framebuffer console with Linux 2.4 and the
Voodoo 3 and Matrox Millennium or G400.