Bug#884100: gnome-settings-daemon: backlight control broken on recent laptops with hybrid graphics

Luca Boccassi bluca at debian.org
Mon Dec 11 12:31:05 UTC 2017


Package: gnome-settings-daemon
Version: 3.22.2-2+deb9u2
Severity: important
Tags: patch stretch
Fixed: 3.24
Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=782211

Dear Maintainer,

On a brand-new Dell Precision 7520 with hybrid graphics (Intel iGPU +
AMD dGPU) gsd-backlight-helper changes the wrong brightness control -
it tries to modify the AMD dGPU sysfs value, which does not actually
control the screen:

$ ls /sys/class/backlight/
amdgpu_bl0  intel_backlight

gsd writes to amdgpu_bl0 instead of intel_backlight. Note that I've
tried numerous kernel command line workarounds that I found related to
brightness control issues, including:

video.use_bios_initial_backlight=0
video.use_native_backlight=1
acpi_osi="!Windows 2012"
acpi_osi="!Windows 2009"
video.use_native_backlight=0
acpi_backlight=video/vendor/native/none

And also a newer kernel from stretch-backports. None of this fixes the
problem.

But this bug has been fixed upstream, in the mentioned bugzilla.

The patch is quite simple, it applies cleanly to 3.22, I've tested it
and it fixes the problem for me - with the change, the screen
brightness controls function as expected.

Please consider this patch for the next Stretch point release if
possible.

Thanks!

-- 
Kind regards,
Luca Boccassi


From ed7c2744aca1ad0bdd5adb62a8f2b5bdc1eb94b4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede at redhat.com>
Date: Mon, 8 May 2017 15:07:18 +0200
Subject: [PATCH] power: Choose correct backlight device on laptops with
 hybrid graphics

On laptops with hybrid graphics the LCD panel may be connected to
a mux so that it can be driven by either GPU. In this case both
GPU drivers will register a raw backlight interface for their
LCD panel connector and g-s-d needs to pick the one for the enabled
connector rather then just picking the first one.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1683445
https://bugzilla.gnome.org/show_bug.cgi?id=782211
---
 plugins/power/gsd-backlight-linux.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/plugins/power/gsd-backlight-linux.c b/plugins/power/gsd-backlight-linux.c
index 54d6f9dc..27b56ae9 100644
--- a/plugins/power/gsd-backlight-linux.c
+++ b/plugins/power/gsd-backlight-linux.c
@@ -43,6 +43,40 @@ gsd_backlight_helper_get_type (GList *devices, const gchar *type)
 	}
 	return NULL;
 }
+
+/*
+ * Search for a raw backlight interface, raw backlight interfaces registered
+ * by the drm driver will have the drm-connector as their parent, check the
+ * drm-connector's enabled sysfs attribute so that we pick the right LCD-panel
+ * connector on laptops with hybrid-gfx. Fall back to just picking the first
+ * raw backlight interface if no enabled interface is found.
+ */
+static gchar *
+gsd_backlight_helper_get_raw (GList *devices)
+{
+	GUdevDevice *parent;
+	const gchar *attr;
+	GList *d;
+
+	for (d = devices; d != NULL; d = d->next) {
+		attr = g_udev_device_get_sysfs_attr (d->data, "type");
+		if (g_strcmp0 (attr, "raw") != 0)
+			continue;
+
+		parent = g_udev_device_get_parent (d->data);
+		if (!parent)
+			continue;
+
+		attr = g_udev_device_get_sysfs_attr (parent, "enabled");
+		if (!attr || g_strcmp0 (attr, "enabled") != 0)
+			continue;
+
+		return g_strdup (g_udev_device_get_sysfs_path (d->data));
+	}
+
+	return gsd_backlight_helper_get_type (devices, "raw");
+}
+
 #endif /* HAVE_GUDEV */
 
 char *
@@ -72,7 +106,7 @@ gsd_backlight_helper_get_best_backlight (GsdBacklightType *type)
 			*type = GSD_BACKLIGHT_TYPE_PLATFORM;
 		goto out;
 	}
-	path = gsd_backlight_helper_get_type (devices, "raw");
+	path = gsd_backlight_helper_get_raw (devices);
 	if (path != NULL) {
 		if (type)
 			*type = GSD_BACKLIGHT_TYPE_RAW;
-- 
2.14.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-gnome-maintainers/attachments/20171211/a7b5c209/attachment.sig>


More information about the pkg-gnome-maintainers mailing list