xf86-video-amdgpu: Branch 'master' - 3 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Jun 28 16:42:03 UTC 2018


 src/drmmode_display.c |   66 +++++++++++++++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 30 deletions(-)

New commits:
commit baea4fa492f635cdfe746a84be2e337d9aeae8a9
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jun 26 19:02:21 2018 +0200

    Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap
    
    Instead of from drmmode_set_mode_major. There's no need to re-set the
    gamma LUT on every modeset, the kernel should preserve it.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 5fe49b6..9364a88 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1353,12 +1353,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		else
 			drmmode_crtc->scanout_id = 0;
 
-		/* gamma is disabled in kernel driver for deep color */
-		if (pScrn->depth != 30)
-			drmmode_crtc_gamma_do_set(
-				crtc, crtc->gamma_red, crtc->gamma_green,
-				crtc->gamma_blue, crtc->gamma_size);
-
 		if (drmmode_crtc->prime_scanout_pixmap) {
 			drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
 							  &fb, &x, &y);
@@ -3450,6 +3444,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 {
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+	int i;
 
 	if (xf86_config->num_crtc) {
 		xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
@@ -3457,13 +3452,23 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 		if (!miCreateDefColormap(pScreen))
 			return FALSE;
 		/* All radeons support 10 bit CLUTs. They get bypassed at depth 30. */
-		if (pScrn->depth != 30 &&
-		    !xf86HandleColormaps(pScreen, 256, 10,
-					 NULL, NULL,
-					 CMAP_PALETTED_TRUECOLOR
-					 | CMAP_RELOAD_ON_MODE_SWITCH))
-			return FALSE;
+		if (pScrn->depth != 30) {
+			if (!xf86HandleColormaps(pScreen, 256, 10, NULL, NULL,
+						 CMAP_PALETTED_TRUECOLOR
+						 | CMAP_RELOAD_ON_MODE_SWITCH))
+				return FALSE;
+
+			for (i = 0; i < xf86_config->num_crtc; i++) {
+				xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+				drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red,
+							  crtc->gamma_green,
+							  crtc->gamma_blue,
+							  crtc->gamma_size);
+			}
+		}
 	}
+
 	return TRUE;
 }
 
commit 19a40758be04e1d451a030f452efb49e8aaad541
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jun 27 18:36:43 2018 +0200

    Remove #if 0'd code
    
    This has always been disabled, no need to keep it.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Slava Abramov <slava.abramov at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1563417..5fe49b6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2459,15 +2459,6 @@ static const xf86OutputFuncsRec drmmode_output_funcs = {
 	.create_resources = drmmode_output_create_resources,
 	.set_property = drmmode_output_set_property,
 	.get_property = drmmode_output_get_property,
-#if 0
-
-	.save = drmmode_crt_save,
-	.restore = drmmode_crt_restore,
-	.mode_fixup = drmmode_crt_mode_fixup,
-	.prepare = drmmode_output_prepare,
-	.mode_set = drmmode_crt_mode_set,
-	.commit = drmmode_output_commit,
-#endif
 	.detect = drmmode_output_detect,
 	.mode_valid = drmmode_output_mode_valid,
 
@@ -3470,9 +3461,6 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 		    !xf86HandleColormaps(pScreen, 256, 10,
 					 NULL, NULL,
 					 CMAP_PALETTED_TRUECOLOR
-#if 0				/* This option messes up text mode! (eich at suse.de) */
-					 | CMAP_LOAD_EVEN_IF_OFFSCREEN
-#endif
 					 | CMAP_RELOAD_ON_MODE_SWITCH))
 			return FALSE;
 	}
commit 8e98195e58f77fd1f354b2707360bd4445aef5b4
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jun 26 18:40:23 2018 +0200

    Don't apply gamma to HW cursor data if colour management is enabled
    
    In that case (with DC as of 4.17 kernels), the display hardware applies
    gamma to the HW cursor.
    
    v2:
    * Also use all 0s when alpha == 0 in the gamma passthrough case.
    
    Bugzilla: https://bugs.freedesktop.org/106578
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fa0c05b..1563417 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1516,6 +1516,17 @@ drmmode_cursor_src_offset(Rotation rotation, int width, int height,
 #endif
 
 static uint32_t
+drmmode_cursor_gamma_passthrough(xf86CrtcPtr crtc, uint32_t argb)
+{
+	uint32_t alpha = argb >> 24;
+
+	if (!alpha)
+		return 0;
+
+	return argb;
+}
+
+static uint32_t
 drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
 {
 	uint32_t alpha = argb >> 24;
@@ -1525,9 +1536,6 @@ drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
 	if (!alpha)
 		return 0;
 
-	if (crtc->scrn->depth != 24 && crtc->scrn->depth != 32)
-		return argb;
-
 	/* Un-premultiply alpha */
 	for (i = 0; i < 3; i++)
 		rgb[i] = ((argb >> (i * 8)) & 0xff) * 0xff / alpha;
@@ -1544,6 +1552,12 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
 {
 	ScrnInfoPtr pScrn = crtc->scrn;
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+	uint32_t (*cursor_gamma)(xf86CrtcPtr crtc, uint32_t argb) =
+		drmmode_cursor_gamma;
+
+	if ((crtc->scrn->depth != 24 && crtc->scrn->depth != 32) ||
+	    drmmode_cm_enabled(&info->drmmode))
+		cursor_gamma = drmmode_cursor_gamma_passthrough;
 
 #if XF86_CRTC_VERSION < 7
 	if (crtc->driverIsPerformingTransform) {
@@ -1559,8 +1573,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
 								      dstx, dsty);
 
 				ptr[dsty * info->cursor_w + dstx] =
-					cpu_to_le32(drmmode_cursor_gamma(crtc,
-									 image[srcoffset]));
+					cpu_to_le32(cursor_gamma(crtc, image[srcoffset]));
 			}
 		}
 	} else
@@ -1570,7 +1583,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
 		int i;
 
 		for (i = 0; i < cursor_size; i++)
-			ptr[i] = cpu_to_le32(drmmode_cursor_gamma(crtc, image[i]));
+			ptr[i] = cpu_to_le32(cursor_gamma(crtc, image[i]));
 	}
 }
 


More information about the xorg-commit mailing list