summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-01-28 12:51:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-01-28 12:51:00 +0000
commitb99c8cbefdd8fec686ad81fbffebb70d43880779 (patch)
treeb43a10dbd11eba147de6166262eb90b803735bfc
parent47effa1854e331643302146db238e6b092de8a9a (diff)
sna: Cancel the backlight change if set-property(DPMS) fails
If the kernel reports an error from setting the DPMS property, we need to undo the local changes and propagate back the error to the caller. Although the latter is prevented by the RandR API, we can at least restore the backlight. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c28f558c..cf3e5761 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2418,11 +2418,12 @@ sna_output_dpms(xf86OutputPtr output, int dpms)
sna_output->dpms_mode,
dpms);
- if (output->crtc)
- drmModeConnectorSetProperty(sna->kgem.fd,
- sna_output->id,
- sna_output->dpms_id,
- dpms);
+ if (output->crtc &&
+ drmModeConnectorSetProperty(sna->kgem.fd,
+ sna_output->id,
+ sna_output->dpms_id,
+ dpms))
+ dpms = sna_output->dpms_mode;
if (dpms == DPMSModeOn)
sna_output_dpms_backlight(output,