xf86-video-intel: src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Oct 15 03:31:33 PDT 2013


 src/sna/sna_display.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 41b6b792d8e9c84c0a71a4bd7600e1c42e86b5bd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 15 11:23:19 2013 +0100

    sna: Preserve the user backlight value for get_property calls
    
    When querying the current backlight value, be sure not to overwrite the
    last user set value by the call to RRChangeOutputProperty.
    RRChangeOutputProperty calls into set_backlight_property, tricking us
    into believing that the user has set a new backlight value. The result
    is that we end up believing that the user chooses a 0 backlight if she
    should happen to query the property whilst the output is disabled.
    
    Reported-by: reztho at archlinux.us
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70406
    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 ad5b5cd..31d1ceb 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2455,18 +2455,28 @@ sna_output_get_property(xf86OutputPtr output, Atom property)
 	int err;
 
 	if (property == backlight_atom || property == backlight_deprecated_atom) {
+		int old_backlight;
 		INT32 val;
 
-		if (! sna_output->backlight_iface)
+		if (!sna_output->backlight_iface)
 			return FALSE;
 
 		val = sna_output_backlight_get(output);
 		if (val < 0)
 			return FALSE;
 
+		/* Preserve our value of the current user backlight level so that we
+		 * avoid mixing in automatic resetting of the backlight across DPMS
+		 * events. The property query should ideally always be idempotent.
+		 */
+		old_backlight = sna_output->backlight_active_level;
+
 		err = RRChangeOutputProperty(output->randr_output, property,
 					     XA_INTEGER, 32, PropModeReplace, 1, &val,
 					     FALSE, TRUE);
+
+		sna_output->backlight_active_level = old_backlight;
+
 		if (err != 0) {
 			xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
 				   "RRChangeOutputProperty error, %d\n", err);


More information about the xorg-commit mailing list