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>
This commit is contained in:
Chris Wilson 2014-01-28 12:51:00 +00:00
parent 47effa1854
commit b99c8cbefd
1 changed files with 6 additions and 5 deletions

View File

@ -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,