The Brightness and Constrast can be changed on-the-fly (while another program has the Xvideo port open) but the GAMMA values cannot. There's actually a comment saying that this is enforced:
/* Avoid video anomalies, so set gamma registers when overlay is off */
Setting the gamma values with a command like:
$ xvattr -a XV_GAMMA1 -v $((0x00ff00))
or:
$ for G in XV_GAMMA{0,2,4} ; do xvattr -a $G -v $((0xff0000)) ; done
causes the display to go mostly RED, GREEN or BLUE. So it's clear that this is some sort of image/mask or multiple channel gamma ramp.
The values are initalised in a very mask-like way:
I do not understand the '0xc0' values since this covers two bits and the rest only cover 1 bit. It could be that these are a 6-step linear approximation to the desired gamma ramp. To support this there is various code like:
This seems to be related to XV_GAMMA handling. There's a lack of documentation at what exactly the six registers do.
$ sudo apt-get install xvattr
$ xvattr | awk '/ Name/{printf$ 2}/Current/ {printf" \t%08#x\ n",$3}'
XV_COLORKEY 0x0101fe
XV_BRIGHTNESS 0xffffffffffffffff
XV_CONTRAST 0x00007f
XV_GAMMA0 0x00fe83
XV_GAMMA1 0x00ff00
XV_GAMMA2 0x00fe83
XV_GAMMA3 0x00ff00
XV_GAMMA4 0x00fe83
XV_GAMMA5 0x00ff00
The Brightness and Constrast can be changed on-the-fly (while another program has the Xvideo port open) but the GAMMA values cannot. There's actually a comment saying that this is enforced:
/* Avoid video anomalies, so set gamma registers when overlay is off */
Setting the gamma values with a command like:
$ xvattr -a XV_GAMMA1 -v $((0x00ff00))
or:
$ for G in XV_GAMMA{0,2,4} ; do xvattr -a $G -v $((0xff0000)) ; done
causes the display to go mostly RED, GREEN or BLUE. So it's clear that this is some sort of image/mask or multiple channel gamma ramp.
The values are initalised in a very mask-like way:
./src/ i830_video. c: pPriv->gamma5 = 0xc0c0c0; i830_video. c: pPriv->gamma4 = 0x808080; i830_video. c: pPriv->gamma3 = 0x404040; i830_video. c: pPriv->gamma2 = 0x202020; i830_video. c: pPriv->gamma1 = 0x101010; i830_video. c: pPriv->gamma0 = 0x080808;
./src/
./src/
./src/
./src/
./src/
I do not understand the '0xc0' values since this covers two bits and the rest only cover 1 bit. It could be that these are a 6-step linear approximation to the desired gamma ramp. To support this there is various code like:
pPriv->gamma0 = value;
if (pPriv->gamma1 - pPriv->gamma0 > 0x7d)
pPriv->gamma1 = pPriv->gamma0 + 0x7d;
However for a masked-value, "randomly" adding 0x7d in just the blue channel is tottally broken.