xf86-video-intel: src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Jun 26 09:02:26 PDT 2013
src/sna/sna_display.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
New commits:
commit d7be3df2fe632bbc8e4f09709cf3cf7a5ef61015
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Jun 26 17:01:37 2013 +0100
sna: Se the default gamma if left uninitialized by the driver
Due to a bug in i915.ko the gamma ramp is left uninitialised...
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 ed9f448..aafde15 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3016,6 +3016,7 @@ static bool sna_probe_initial_configuration(struct sna *sna)
gamma = malloc(3 * mode.gamma_size * sizeof(uint16_t));
if (gamma) {
struct drm_mode_crtc_lut lut;
+ bool gamma_set = false;
lut.crtc_id = mode.crtc_id;
lut.gamma_size = mode.gamma_size;
@@ -3023,12 +3024,25 @@ static bool sna_probe_initial_configuration(struct sna *sna)
lut.green = (uintptr_t)(gamma + mode.gamma_size);
lut.blue = (uintptr_t)(gamma + 2 * mode.gamma_size);
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETGAMMA, &lut) == 0) {
- free(crtc->gamma_red);
- crtc->gamma_size = mode.gamma_size;
- crtc->gamma_red = gamma;
- crtc->gamma_green = gamma + mode.gamma_size;
- crtc->gamma_blue = gamma + 2*mode.gamma_size;
+ gamma_set =
+ gamma[mode.gamma_size - 1] &&
+ gamma[2*mode.gamma_size - 1] &&
+ gamma[3*mode.gamma_size - 1];
}
+
+ if (!gamma_set) {
+ for (j = 0; j < mode.gamma_size; j++) {
+ gamma[j] = j << 8;
+ gamma[mode.gamma_size + j] = j << 8;
+ gamma[2* mode.gamma_size + j] = j << 8;
+ }
+ }
+
+ free(crtc->gamma_red);
+ crtc->gamma_size = mode.gamma_size;
+ crtc->gamma_red = gamma;
+ crtc->gamma_green = gamma + mode.gamma_size;
+ crtc->gamma_blue = gamma + 2*mode.gamma_size;
}
}
More information about the xorg-commit
mailing list