Created attachment 333968 [details, diff]
SDL_SetGamma() allows to change screen gamma. Problem is it has no effect since xorg-server-1.7 (almost three years back). Try to run any SDL application, games usually supports setting gamma, or compile test/testgamma.c demo from libsdl tar ball (run it and press Up or Down to change gamma value).
SDL supports two methods how to change gamma: Directly and changing color palette. SDL_SetGamma() prefers changing palette but this is broken in Xorg server, so it does not change colors neither signal failure. This is problem in Xorg, but it's not likely to be fixed. See <https://bugs.freedesktop.org/show_bug.cgi?id=27222> for more details.
Attached patch fixes this problem on SDL side. Tested with media-libs/libsdl-1.2.15-r2 and x11-base/xorg-server-1.13.1 on amd64.
Created attachment 334240 [details, diff]
SDL fix 2
This patch removes unneeded SDL_ClearError() call in addition.
Upstream bug report <http://bugzilla.libsdl.org/show_bug.cgi?id=1680>.
in portage. thanks for the bug report and patch.