FrozenSand / UrbanTerror4

Official bug tracker for the game Urban Terror 4.x - www.urbanterror.info
77 stars 18 forks source link

Linux SDL Gamma Fix Breaks Colour Profile #410

Closed ThomasBrierley closed 7 years ago

ThomasBrierley commented 7 years ago

Ever since i've been using UrT on Linux I've had to run it through a script to fix the colour profile on exit. I have to use a colour profile on my old MBP because with those screens everything is very blue without it.

I recently tracked this down to XF86VidModeSetGamma which can be turned off with USE_ALTGAMMA=0 in the makefile, this was added in Barbatos/ioq3-for-UrbanTerror-4@08f8e99 to fix the long standing SDL bug #24 which is still an issue (turning altgamma off breaks the brightness control still).

I'm not very familiar with colour profiles on linux so it's possible this is also my fault, I don't have a full DE I just use i3wm and load my profile via xinitrc with xcalib.

If this also affects others using colour profiles maybe there is a way to adjust the gamma without overriding the colour profile.

ThomasBrierley commented 7 years ago

Actually I think this might be a limitation of xcalib which just sets calibration curves, changing gamma with xgamma or xrandr has the same affect as XF86VidModeSetGamma. I think a deamon like iccd might set things in a more persistent way.

I just liked the fact that xcalib "just works"... all the color deamons seem like such a faf to get working, guess I will give iccd another bash.

[EDIT]

Tried dispwin from argyll and still no joy, I think maybe lXxf86vm is just to primitive to preserve color ramps. I guess UrT will continue to be very blue unless SDL is ever fixed.

ThomasBrierley commented 7 years ago

In case anyone is interested...

SDL2 is still broke and XF86VidModeSetGamma which is used instead will definitely break any colour profiles. Couldn't figure out any other solution so i dealt with it externally:

in MakeFile:

-USE_ALTGAMMA   =1
+USE_ALTGAMMA   =0

This will of course break in game brightness adjustments. Instead just run UrT from a script and wrap it in some gamma adjustments with whatever your colour managment utility is, for me this is the super basic xcalib so i have to give it the path to my profile each time, a bit dirty but it works...

#!/usr/bin/env sh

dir=`dirname $0`

synclient TouchpadOff=1
xcalib -gc 0.6 /usr/share/color/icc/mbp51.icc

$dir/Quake3-UrT.x86_64

synclient TouchpadOff=0
xcalib -gc 1 /usr/share/color/icc/mbp51.icc

Now everything looks sOooo much better, didn't realise just how posterized and blue everything was before! image