From a14c0cd3c1a0fadc141f68a3c4edafa60f0d083a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 25 Apr 2015 22:48:13 +0100 Subject: [PATCH] sna: Disable CRTC if we fail to set DPMS mode on the output Reported-by: Lukas Hejtmanek References: https://bugs.freedesktop.org/show_bug.cgi?id=90179 Signed-off-by: Chris Wilson --- src/sna/compiler.h | 2 +- src/sna/sna_display.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sna/compiler.h b/src/sna/compiler.h index c723137..5e0f26e 100644 --- a/src/sna/compiler.h +++ b/src/sna/compiler.h @@ -63,7 +63,7 @@ #define sse4_2 __attribute__((target("sse4.2,sse2,fpmath=sse"))) #endif -#if HAS_GCC(4, 6) && defined(__OPTIMIZE__) +#if HAS_GCC(4, 6) && !HAS_GCC(5, 0) && defined(__OPTIMIZE__) #define fast __attribute__((optimize("Ofast"))) #else #define fast diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 3ba2df9..1d1b33f 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -3597,6 +3597,8 @@ sna_output_dpms(xf86OutputPtr output, int dpms) if (old_dpms == dpms) return; + sna_output->dpms_mode = dpms; + /* Record the value of the backlight before turning * off the display, and reset if after turning it on. * Order is important as the kernel may record and also @@ -3610,7 +3612,6 @@ sna_output_dpms(xf86OutputPtr output, int dpms) DBG(("%s: saving current backlight %d\n", __FUNCTION__, sna_output->backlight_active_level)); } - sna_output->dpms_mode = dpms; sna_output_backlight_off(sna_output); } @@ -3618,16 +3619,17 @@ sna_output_dpms(xf86OutputPtr output, int dpms) drmModeConnectorSetProperty(sna->kgem.fd, sna_output->id, sna_output->dpms_id, - dpms)) - dpms = old_dpms; + dpms)) { + ERR(("%s: failed to set DPMS mode [%d->%d] on output %s: %d\n", + __FUNCTION__, old_dpms, dpms, output->name, errno)); + sna_crtc_disable(output->crtc, false); + } if (sna_output->backlight.iface && dpms == DPMSModeOn) { DBG(("%s: restoring previous backlight %d\n", __FUNCTION__, sna_output->backlight_active_level)); sna_output_backlight_on(sna_output); } - - sna_output->dpms_mode = dpms; } static bool -- 2.1.4