Gamma bug? Need testers

I need some X11 users to try the following program; there’s either a bug
in SDL or a bug in my old-but-not-stable-branch XFree86 setup.

Basically, SDL_SetGamma() doesn’t work if you create an X11 window. If you
create a fullscreen window first, though, it does. Can someone verify this
behaviour for me? Thanks.

–ryan.

#include <stdio.h>
#include “SDL.h”

int main(void)
{
setbuf(stdout, NULL);

SDL_Init(SDL_INIT_VIDEO);

// if you uncomment this SetVideoMode() call, gamma works, below.
//SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN);
//sleep(5);

SDL_SetVideoMode(640, 480, 0, 0);  // switch back to/create a window.

sleep(2);
printf("setting gamma to 2.0 ...\n");
if (SDL_SetGamma(2.0, 2.0, 2.0) == -1)
    printf("no gamma set: %s\n", SDL_GetError());

sleep(5);
printf("setting gamma to 0.5 ...\n");
if (SDL_SetGamma(0.5, 0.5, 0.5) == -1)
    printf("no gamma set: %s\n", SDL_GetError());
sleep(5);

SDL_Quit();

return(0);

}

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On Saturday 07 September 2002 22:27, Ryan C. Gordon wrote:

I need some X11 users to try the following program; there’s either a bug
in SDL or a bug in my old-but-not-stable-branch XFree86 setup.

Basically, SDL_SetGamma() doesn’t work if you create an X11 window. If
you create a fullscreen window first, though, it does. Can someone verify
this behaviour for me? Thanks.

Works perfectly here, both with and without the fullscreen change, using SDL
1.2.4 and XFree 4.1.

cu,
Nicolai
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9enDgsxPozBga0lwRAkMJAKCWsJn8Sq7BCy4l+62U3GJ/8mw6KACffvUQ
eupc1WNTxdrichMVY/6icBo=
=G7OY
-----END PGP SIGNATURE-----

Ryan,

I’m not really up on what gamma does, but here is wht I get on my system
(SDL 1.2.1, X3.3.6, Mandrake 8, ATI Mach64 card):

setting gamma to 2.0 …
no gamma set: Gamma correction not supported on this visual
setting gamma to 0.5 …
no gamma set: Gamma correction not supported on this visual

(plus a blank window or fullscreen)

with either mode (fullscreen or windowed).

Nick

“Ryan C. Gordon” escribi?:

I need some X11 users to try the following program; there’s either a bug
in SDL or a bug in my old-but-not-stable-branch XFree86 setup.

Basically, SDL_SetGamma() doesn’t work if you create an X11 window. If you
create a fullscreen window first, though, it does. Can someone verify this
behaviour for me? Thanks.

System: linux 2.4.19, X 4.1.0, SDL 1.2.4, WM: AfterStep (no gnome/kde).
Hardware: Athlon 850, Riva TNT2 (nVidia drivers rev. 29.60)

Results: On windowed mode, all was fine. No error messages, gamma actually
changed as expected (seen on desktop decorations).
On fullscreen mode, it appears to go well, as no error messages appeared, but
it’s a bit hardy to distinguish gamma changes on a black screen :slight_smile:

Regards,
Wizord.

[ … ]

I’ve tested your program on my system with and without fullscreen mode
setting using both x11 and dga drivers. It doesn’t change gamma at all,
regardless of anything. No errors are generated. xgamma command does work.

Strange. Maybe it’s an X bug after all?

My system:
Linux kernel 2.4.3
XFree86 4.0.3
NVIDIA drivers 29.60
SDL 1.2.4

Regards,
pke.On Sat, Sep 07, 2002 at 04:27:51PM -0400, Ryan C. Gordon wrote:

I need some X11 users to try the following program; there’s either a bug
in SDL or a bug in my old-but-not-stable-branch XFree86 setup.

Basically, SDL_SetGamma() doesn’t work if you create an X11 window. If you
create a fullscreen window first, though, it does. Can someone verify this
behaviour for me? Thanks.

–ryan.

setting gamma to 2.0 …
no gamma set: Gamma correction not supported on this visual
setting gamma to 0.5 …
no gamma set: Gamma correction not supported on this visual

(plus a blank window or fullscreen)

with either mode (fullscreen or windowed).

That’s expected on Xfree3.3.

Thank you!

–ryan.

Results: On windowed mode, all was fine. No error messages, gamma actually
changed as expected (seen on desktop decorations).
On fullscreen mode, it appears to go well, as no error messages appeared, but
it’s a bit hardy to distinguish gamma changes on a black screen :slight_smile:

The fullscreen was just there to show that the windowed version works on
my box after you switch to fullscreen and back.

Thanks!

–ryan.

Strange. Maybe it’s an X bug after all?

My system:
Linux kernel 2.4.3
XFree86 4.0.3
NVIDIA drivers 29.60
SDL 1.2.4

It’s possible. We aren’t checking the return value from XStoreColors, but
I’m willing to believe it’s hosed in the Xserver before 4.2.0 or so, and
won’t lose sleep over it.

–ryan.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My system:
Linux 2.4.18
Using tdfx (Voodoo Banshee) driver
XFree86 4.2.0
SDL 1.2.4

Everything works just fine. =]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9fIuYeE16Tt8QwtURAt2ZAJ4/WpbhXCMdcI7TOh6gbijH4Wf0NwCeNcOp
/+ZX+GIjAvRcVrt4tU2T/Qk=
=63Fr
-----END PGP SIGNATURE-----

Kaixo Ryan C. Gordon!!!

I need some X11 users to try the following program; there’s either a bug
in SDL or a bug in my old-but-not-stable-branch XFree86 setup.

Basically, SDL_SetGamma() doesn’t work if you create an X11 window. If you
create a fullscreen window first, though, it does. Can someone verify this
behaviour for me? Thanks.

Without fullscreen, no errors but no gamma is changed
With fullscreen, no errors and gamma changed

hardware/Software:

VGA compatible controller: nVidia Corporation Vanta [NV6]
Xfree 4.1.0 (debian 4.1.0-16)
SDL 1.2.4 (debian 1.2.4-1)

Also keep in mind that the window won’t have its gamma changed unless it
has focus. This may affect results depending on your window manager settings.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Also keep in mind that the window won’t have its gamma changed unless it
has focus. This may affect results depending on your window manager settings.

I noticed that in the code, and played around to verify this. I do have
focus (and pointer inside the window…see last message about
ACTIVEEVENT); SDL is telling X11 to switch, and X11 just doesn’t. It’s a
server bug, I’m fairly certain, and am not losing sleep over it.

–ryan.

I’ve just tried the program a couple more times and that’s what I’ve found:
when fullscreen setting is enabled and after going back to window mode
the program window remains active, gamma setting does work.
But if you switch the window to background (I did that to see
’setting gamma to…’ messages in xterm) gamma setting doesn’t change.

Anyway since this seems to be already fixed in 4.2.0 I agree that it’s
not a problem.

Sorry for the haste with the first email.

Regards, pke.On Sun, Sep 08, 2002 at 08:25:47PM -0400, Ryan C. Gordon wrote:

Strange. Maybe it’s an X bug after all?

My system:
Linux kernel 2.4.3
XFree86 4.0.3
NVIDIA drivers 29.60
SDL 1.2.4

It’s possible. We aren’t checking the return value from XStoreColors, but
I’m willing to believe it’s hosed in the Xserver before 4.2.0 or so, and
won’t lose sleep over it.

–ryan.