From b99c8cbefdd8fec686ad81fbffebb70d43880779 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 28 Jan 2014 12:51:00 +0000 Subject: [PATCH] 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 --- src/sna/sna_display.c | 11 ++++++----- 1 file 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,