From: Hans de Goede Subject: [PATCH] backlight: Don't read back backlight setting from kernel on DPMS off Date: Thu, 5 Jun 2014 15:48:38 +0200 Message-ID: <1401976118-8780-1-git-send-email-hdegoede@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 2DA7C6E95C for ; Thu, 5 Jun 2014 06:48:42 -0700 (PDT) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s55Dmepg027472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 5 Jun 2014 09:48:41 -0400 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org We've several reports from users where the backlight comes up turned off on starting X, when using video.use_native_backlight=1 (true dmi quirks, will be the default for 3.16), in combination with having an external display plugged in: https://bugzilla.redhat.com/show_bug.cgi?id=1032978 https://bugzilla.redhat.com/show_bug.cgi?id=1103806 This seems to be caused by /sys/class/backlight/intel_backlight/brightness reading back 0 when re-initializing the outputs. Unlike /sys/class/backlight/acpi_video0/brightness which is used without the video.use_native_backlight=1 param, which keeps returning the value from before Here is an excerpt from Xorg.log when this happens: [28225]: (II) intel(0): resizing framebuffer to 3286x1080 [28225]: (II) intel(0): switch to mode 1366x768@59.8 on pipe 0 using LVDS1, position (0, 0), rotation normal [28225]: (II) intel(0): switch to mode 1920x1080@60.0 on pipe 0 using HDMI2, position (1366, 0), rotation normal [28225]: (II) intel(0): DPMS off mode 3, saved backlight level 0 ^^^ This is an extra debug line I added, mode == the mode parameter to xxx_output_dpms_backlight, saved backlight level is the value of backlight_active_level after the xxx_output_backlight_get call. Note how backlight_active_level becomes 0 here. [28225]: (II) intel(0): switch to mode 1366x768@59.8 on pipe 1 using LVDS1, position (0, 0), rotation normal [28225]: (II) intel(0): DPMS on mode 0, setting backlight to 0 And here we restore the backlight to backlight_active_level which now is 0. This commit fixes this by not reading back the backlight setting from the kernel on DPMS off. Signed-off-by: Hans de Goede --- src/sna/sna_display.c | 3 --- src/uxa/intel_display.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 13dbf64..c9d4b08 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -2323,9 +2323,6 @@ sna_output_dpms_backlight(xf86OutputPtr output, int oldmode, int mode) sna_output_backlight_set(output, sna_output->backlight_active_level); } else { - /* Only save the current backlight value if we're going from on to off. */ - if (oldmode == DPMSModeOn) - sna_output->backlight_active_level = sna_output_backlight_get(output); sna_output_backlight_set(output, 0); } } diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c index 95ddcc8..62902f4 100644 --- a/src/uxa/intel_display.c +++ b/src/uxa/intel_display.c @@ -963,9 +963,6 @@ intel_output_dpms_backlight(xf86OutputPtr output, int oldmode, int mode) intel_output_backlight_set(output, intel_output->backlight_active_level); } else { - /* Only save the current backlight value if we're going from on to off. */ - if (oldmode == DPMSModeOn) - intel_output->backlight_active_level = intel_output_backlight_get(output); intel_output_backlight_set(output, 0); } } -- 2.0.0