xf86-video-intel: src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jul 3 14:56:56 PDT 2013


 src/sna/sna_display.c |   54 +++++++++++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

New commits:
commit ebf4517a0bb510e406795c169aa21b7cc615ed31
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 3 22:44:46 2013 +0100

    sna: Always read back the gamma, even for a inactive CRTC
    
    Even if the CRTC is inactive, we still need to initialise the gamma
    tables.
    
    Reported-and-tested-by: Timo Kamph <timo at kamph.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66563
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c124c22..d007472 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3001,32 +3001,7 @@ static bool sna_probe_initial_configuration(struct sna *sna)
 		crtc->enabled = FALSE;
 		crtc->desiredMode.status = MODE_NOMODE;
 
-		VG_CLEAR(mode);
-		mode.crtc_id = sna_crtc->id;
-		if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode))
-			continue;
-
-		if (!mode.mode_valid)
-			continue;
-
-		memset(&crtc->desiredMode, 0, sizeof(crtc->desiredMode));
-		mode_from_kmode(scrn, &mode.mode, &crtc->desiredMode);
-		crtc->desiredRotation = RR_Rotate_0;
-		crtc->desiredX = mode.x;
-		crtc->desiredY = mode.y;
-		crtc->desiredTransformPresent = FALSE;
-
-		crtc->mode = crtc->desiredMode;
-		crtc->mode.name = NULL;
-		crtc->x = mode.x;
-		crtc->y = mode.y;
-		crtc->rotation = RR_Rotate_0;
-		crtc->transformPresent = FALSE;
-
-		memset(&crtc->panningTotalArea, 0, sizeof(BoxRec));
-		memset(&crtc->panningTrackingArea, 0, sizeof(BoxRec));
-		memset(crtc->panningBorder, 0, 4 * sizeof(INT16));
-
+		/* Initialize the gamma ramps */
 		gamma = malloc(3 * mode.gamma_size * sizeof(uint16_t));
 		if (gamma) {
 			struct drm_mode_crtc_lut lut;
@@ -3058,6 +3033,33 @@ static bool sna_probe_initial_configuration(struct sna *sna)
 			crtc->gamma_green = gamma + mode.gamma_size;
 			crtc->gamma_blue = gamma + 2*mode.gamma_size;
 		}
+
+		/* Retrieve the current mode */
+		VG_CLEAR(mode);
+		mode.crtc_id = sna_crtc->id;
+		if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode))
+			continue;
+
+		if (!mode.mode_valid)
+			continue;
+
+		memset(&crtc->desiredMode, 0, sizeof(crtc->desiredMode));
+		mode_from_kmode(scrn, &mode.mode, &crtc->desiredMode);
+		crtc->desiredRotation = RR_Rotate_0;
+		crtc->desiredX = mode.x;
+		crtc->desiredY = mode.y;
+		crtc->desiredTransformPresent = FALSE;
+
+		crtc->mode = crtc->desiredMode;
+		crtc->mode.name = NULL;
+		crtc->x = mode.x;
+		crtc->y = mode.y;
+		crtc->rotation = RR_Rotate_0;
+		crtc->transformPresent = FALSE;
+
+		memset(&crtc->panningTotalArea, 0, sizeof(BoxRec));
+		memset(&crtc->panningTrackingArea, 0, sizeof(BoxRec));
+		memset(crtc->panningBorder, 0, 4 * sizeof(INT16));
 	}
 
 	/* Reconstruct outputs pointing to active CRTC */


More information about the xorg-commit mailing list