After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782211 - GSD may pick wrong backlight device on some hybrid graphics machine
GSD may pick wrong backlight device on some hybrid graphics machine
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
3.24.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2017-05-05 09:55 UTC by Kai-Heng Feng
Modified: 2017-05-09 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A patch to let GSD pick the correct backlight device (1.94 KB, patch)
2017-05-05 09:57 UTC, Kai-Heng Feng
none Details | Review
[PATCH] power: Choose correct backlight device on laptops with hybrid graphics (2.42 KB, patch)
2017-05-08 14:50 UTC, Hans de Goede
committed Details | Review

Description Kai-Heng Feng 2017-05-05 09:55:50 UTC
The Dell E6430 with Nvidia Optimus enables in BIOS, using the Open Source Nouveau driver shows the brightness slider moving but does not affect the brightness.

https://bugs.launchpad.net/bugs/1683445
Comment 1 Kai-Heng Feng 2017-05-05 09:57:15 UTC
Created attachment 351170 [details] [review]
A patch to let GSD pick the correct backlight device
Comment 2 Hans de Goede 2017-05-08 14:49:15 UTC
Hi Kai-Heng, Bastien,

Small world :)  The somebody in "I had a chat with somebody with some experience" in https://bugs.launchpad.net/bugs/1683445 was me. I actually also have an E6430 and had fixing this on my TODO already after Vincent pointed the bug out to me.

As for the patch, it is not entirely correct, you check for an enabled attribute for all backlight types and skip any backlights without it, the get_parent to get the actual drm-connector will only work on raw interfaces registered by the drm driver itself, so you are now skipping any non-raw and non-drm-driver-registered backlights. Also you should check that enabled != NULL before dereferencing it.

I've written a new patch which only checks the parents "enabled" sysfs attribute for raw interfaces and falls back to just using the first raw interface if no raw interface with enabled == "enabled" is found to avoid regressions.

I'll attach the patch here.

Regards,

Hans
Comment 3 Hans de Goede 2017-05-08 14:50:20 UTC
Created attachment 351354 [details] [review]
[PATCH] power: Choose correct backlight device on laptops with hybrid graphics
Comment 4 Kai-Heng Feng 2017-05-09 04:29:55 UTC
(In reply to Hans de Goede from comment #2)
> Hi Kai-Heng, Bastien,
> 
> Small world :)  The somebody in "I had a chat with somebody with some
> experience" in https://bugs.launchpad.net/bugs/1683445 was me. I actually
> also have an E6430 and had fixing this on my TODO already after Vincent
> pointed the bug out to me.
> 
> As for the patch, it is not entirely correct, you check for an enabled
> attribute for all backlight types and skip any backlights without it, the
> get_parent to get the actual drm-connector will only work on raw interfaces
> registered by the drm driver itself, so you are now skipping any non-raw and
> non-drm-driver-registered backlights. Also you should check that enabled !=
> NULL before dereferencing it.

Thanks! Didn't know that the DRM and backlight worked this way.

> 
> I've written a new patch which only checks the parents "enabled" sysfs
> attribute for raw interfaces and falls back to just using the first raw
> interface if no raw interface with enabled == "enabled" is found to avoid
> regressions.
> 
> I'll attach the patch here.

Looks great, I'll cherry-pick it into unity-settings-daemon when it's being merged.

Thanks for the review and all the info.

> 
> Regards,
> 
> Hans
Comment 5 Rui Matos 2017-05-09 16:21:22 UTC
Review of attachment 351354 [details] [review]:

looks good, thanks
Comment 6 Rui Matos 2017-05-09 16:28:32 UTC
00d1a8a..2ff6738  gnome-3-24 -> gnome-3-24
Comment 7 Rui Matos 2017-05-09 16:29:52 UTC
1dffcf5..ed7c274  master -> master