Skip to contentSkip to conversation

Fix colormap handling at screen depth 30.

PATCH In review Mario Kleiner 2 participants 2 messages Mar 1, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix colormap handling at screen depth 30.

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.

---
 src/nv_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/nv_driver.c +2 -2
index 32062eb..4fcd4c1 100644
@@ -1568,8 +1568,8 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
 	 * Must follow initialization of the default colormap 
 	 */
 	if (xf86_config->num_crtc &&
-	    !xf86HandleColormaps(pScreen, 256, 8, NVLoadPalette,
-				 NULL, CMAP_PALETTED_TRUECOLOR))
+	    !xf86HandleColormaps(pScreen, 1 << pScrn->rgbBits, pScrn->rgbBits,
+				 NVLoadPalette, NULL, CMAP_PALETTED_TRUECOLOR))
 		return FALSE;
 
 	/* Report any unused options (only for the first generation) */
Signature · 6 lines
2.7.4

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20180301063118.3677-1-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

NVLoadPalette is pretty hard-coded to 256. I haven't looked at what all xf86HandleColormaps does, but it seems pretty suspicious. Also note that the kernel currently only exposes a 256-sized LUT to userspace, even for 10bpc modes.

Quoted 33 lines · Mario Kleiner

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.

---
 src/nv_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/nv_driver.c +2 -3
index 32062eb..4fcd4c1 100644
@@ -1568,8 +1568,8 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
         * Must follow initialization of the default colormap
         */
        if (xf86_config->num_crtc &&
-           !xf86HandleColormaps(pScreen, 256, 8, NVLoadPalette,
-                                NULL, CMAP_PALETTED_TRUECOLOR))
+           !xf86HandleColormaps(pScreen, 1 << pScrn->rgbBits, pScrn->rgbBits,
+                                NVLoadPalette, NULL, CMAP_PALETTED_TRUECOLOR))
                return FALSE;
 
        /* Report any unused options (only for the first generation) */
--

2.7.4

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau