summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner.de@gmail.com>2018-06-12 17:58:06 +0200
committerIlia Mirkin <imirkin@alum.mit.edu>2018-12-09 15:25:49 -0500
commit8dd1118369460e03ab4963987901dc9e13a2d53d (patch)
tree5d4f738deb0c2ee1f2c6a3cdd7c73f09c672152d
parentc9ce4b8e86525b6e0ecc814b2c5ebb242fb1f107 (diff)
downloadxorg-driver-xf86-video-nouveau-8dd1118369460e03ab4963987901dc9e13a2d53d.tar.gz
Fix colormap handling at screen depth 30. (v2)
The various clut handling functions like a setup consistent with the x-screen color depth. Otherwise we observe improper sampling in the gamma tables at depth 30. Tested at depths 16, 24 and 30 and tested at depths 24 and 30 that xgamma and gamma table animations work, and with measurement equipment to make sure identity gamma ramps actually are identity mappings at the output. v2: Also deal with X-Server 1.19 and earlier, which as of v1.19.6 lack a fix to color palette handling and can not deal with depths/bpc > 24/8 bpc. On < 1.20 we skip xf86HandleColormaps() setup at > 8 bpc. This disables color palette handling on such servers at > 8 bpc, but still keeps RandR gamma table handling intact. Tested on 1.19.6 and 1.20.0 to do the right thing. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r--src/nv_driver.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 32062eb..a5d50c1 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1565,11 +1565,14 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
/*
* Initialize colormap layer.
- * Must follow initialization of the default colormap
+ * Must follow initialization of the default colormap.
+ * X-Server < 1.20 mishandles > 256 slots / > 8 bpc color maps, so skip
+ * color map setup on old servers at > 8 bpc. Gamma luts still work.
*/
- if (xf86_config->num_crtc &&
- !xf86HandleColormaps(pScreen, 256, 8, NVLoadPalette,
- NULL, CMAP_PALETTED_TRUECOLOR))
+ if (xf86_config->num_crtc && (pScrn->rgbBits <= 8 ||
+ XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,20,0,0,0)) &&
+ !xf86HandleColormaps(pScreen, 1 << pScrn->rgbBits, pScrn->rgbBits,
+ NVLoadPalette, NULL, CMAP_PALETTED_TRUECOLOR))
return FALSE;
/* Report any unused options (only for the first generation) */