First patch concerning 4.3 and refresh rates

OK, here’s my first draft of the patch for the above subject.

A short explanation:

X 4.3 introduces many more modelines than older versions. This would be
fine, except it introduces many modes with the same resolution but
different refresh rates. And SDL won’t necessarily pick the one with the
highest refresh rate.

So this patch restores SDL to X 4.2 functionality. That is, there is only
ever one refresh rate per resolution, and it is the highest possible.
This functionality can be totally disabled by using the environment
variable ‘SDL_VIDEO_X11_USE_ALL_MODES’ set equal to 1.

Some notes:

This works for me with all sorts of open-source games. Previously,
playing Frozen Bubble, Stella, etc. would result in all sorts of strange
modes, including 69, 72, 74, 75 Hz. Now, all the modes use 85 Hz.
Basically, the only way that we won’t get an 85 Hz mode now is if that
mode isn’t provided by X at all.

Closed-source games will also work if they were dynamically compiled.
I’ve tested this on Serious Sam. The other games I have are either
static-compiled or use older versions of SDL.

Apply the patch in the src/video/x11 directory with ‘patch -p0 <’

Constructive criticism is appreciated :slight_smile:

-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_x11modes.diff
Type: text/x-diff
Size: 6593 bytes
Desc: not available

Looks pretty good. I fixed a small bug in it, and applied it to CVS.

-Sam Lantinga, Software Engineer, Blizzard Entertainment