summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-07-03 22:44:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-07-03 22:56:41 +0100
commitebf4517a0bb510e406795c169aa21b7cc615ed31 (patch)
tree10d1b5b2f8d03514309494e8d8479bb004e6c106 /src
parent4def5ecf6ebc2c6dc05e60d4595fa3dd4b7e38d2 (diff)
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@kamph.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66563 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_display.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c124c223..d007472d 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 */