Vertical retrace

Hi

Does SDL normally sync to the vertical retrace to stop tearing etc. in 2D
mode? I have seen that the nVidia drivers have this option but is this for
3D only? Do other drivers sync or is it driver specific?

Thanks

Paul

“Paul” wrote:

Hi

Does SDL normally sync to the vertical retrace to stop tearing etc. in 2D
mode? I have seen that the nVidia drivers have this option but is this
for
3D only? Do other drivers sync or is it driver specific?

Thanks

Paul

Hi Paul,
I’ve tried the normal x11 videodriver but couldn’ get any vsync control. Now
I’m using dga with doublebuffering and SDL_Flip() returns after vsync, so
moving looks very nice!!
regards

It seems to be a very popular belief that tearing is a non-issue, and
that retrace sync just “slows things down”, so it seems like we’re going
to have to live with etiher tearing or custom hacks for a good while
still.

In short, some targets do retrace sync by default, some can do it if
the user fiddles with the configuration, and some (most?) targets can’t
retrace sync at all.

You best bet is trying to get h/w double buffering, and hope that the
driver does retrace sync’ed flips with that setup. (Simulated flipping
with back->front blits aren’t retrace sync’ed on any targets with SDL
AFAIK, although it could actually be implemented on a few targets.)

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 10 October 2001 10:32, Paul wrote:

Hi

Does SDL normally sync to the vertical retrace to stop tearing etc. in
2D mode? I have seen that the nVidia drivers have this option but is
this for 3D only? Do other drivers sync or is it driver specific?

“Paul” wrote:

Hi

Does SDL normally sync to the vertical retrace to stop tearing etc.
in 2D mode? I have seen that the nVidia drivers have this option but
is this

for

3D only? Do other drivers sync or is it driver specific?

Thanks

Paul

Hi Paul,
I’ve tried the normal x11 videodriver but couldn’ get any vsync
control.

That’s because it doesn’t support h/w pageflipping, which is the only way
to get retrace sync with SDL.

Now I’m using dga with doublebuffering and SDL_Flip() returns
after vsync, so moving looks very nice!!

Cool. :slight_smile: I wish that would work on the average XFree86 setup, but that
doesn’t seem to be the case… :-/

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 10 October 2001 13:37, Helge Klein wrote:

Hi,

A few days ago I was working on a SDL program (Win32). When I showed it on a
friends computer the frame rate was horrible. I realized that on my friends
video board, locking of the backbuffer surface is a severe penalty (the
frame rate dropped from 60 to 9). Initializing SDL without a backbuffer and
working with a in system memory framebuffer which get copied to the screen
seems to work oke. But now I can’t wait for a vertical retrace to happen
because I don’t use the flip back and front buffer function. Is there an
other way to wait for a vertical retrace in SDL?

Regards

I can’t say for sure – really haven’t looked, but I doubt it. This is
because X doesn’t support detecting a vertical retrace (or so I heard a
while back).

Only way I could see this being supported is one of the OS specific events.
(I’d check the code, but I’m at my G/F, and don’t have the SDL source here.)> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Leonard Schreur
Sent: Friday, February 01, 2002 5:47 AM
To: sdl at libsdl.org
Subject: [SDL] Vertical retrace

Hi,

A few days ago I was working on a SDL program (Win32). When I showed it on a
friends computer the frame rate was horrible. I realized that on my friends
video board, locking of the backbuffer surface is a severe penalty (the
frame rate dropped from 60 to 9). Initializing SDL without a backbuffer and
working with a in system memory framebuffer which get copied to the screen
seems to work oke. But now I can’t wait for a vertical retrace to happen
because I don’t use the flip back and front buffer function. Is there an
other way to wait for a vertical retrace in SDL?

Regards


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

A few days ago I was working on a SDL program (Win32). When I showed it
on a friends computer the frame rate was horrible. I realized that on
my friends video board, locking of the backbuffer surface is a severe
penalty (the frame rate dropped from 60 to 9).

Ouch! I assume you’re using a great deal of read-modify-write operations,
such as alpha blending…

Initializing SDL without
a backbuffer and working with a in system memory framebuffer which get
copied to the screen seems to work oke. But now I can’t wait for a
vertical retrace to happen because I don’t use the flip back and front
buffer function. Is there an other way to wait for a vertical retrace
in SDL?

No, but there’s another way to avoid the VRAM read problem:

1. Set up a double buffered screen. (Check that you really
   get that! If not, just go with SDL's software double
   buffering.)

2. Create a software back buffer of the same size and format
   as the screen.

Then, for each frame:

* Do all rendering into the software back buffer.

* Blit the software back buffer into the screen back
  buffer. (You may blit only the changed parts, but
  you have to keep track of the two screen buffers!)

* SDL_FlipSurface()

* Repeat!

I’m using this in Kobo Deluxe, where I call it “SemiTriple” buffering.

(Note that it doesn’t work with OpenGL, and that Kobo Deluxe still isn’t
fully aware of the implications of that - in case you were thinking “But
hey, it just flickers and looks bad!”. :slight_smile:

An old trick, but probably more useful than ever, as system RAM access is
only getting faster and faster, while CPU access through PCI and AGP
busses keep sucking real bad.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Friday 01 February 2002 12:46, Leonard Schreur wrote: