Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#18426 closed defect (fixed)

Fix backlight control for XFCE with non-Intel xorg video driver

Reported by: Douglas R. Reno Owned by: Douglas R. Reno
Priority: normal Milestone: 12.0
Component: BOOK Version: git
Severity: blocker Keywords:
Cc:

Description

On some laptops with Intel GPUs, moving to the modesetting driver broke the ability for the xbacklight utility to work. This is because the modesetting driver does not provide the XRANDR Backlight Output property, which the old xf86-video-intel driver did.

GNOME and Plasma both carry their own backlight handlers that take care of this for the user, but most other DEs do not. On affected systems, you'll have no control over the screen backlight, power settings for dimming the screen will not function, and using the keys on your keyboard to adjust the backlight will not work.

I have an affected Dell Latitude E6540 (which I use as my primary laptop) which I can use for testing.

acpilight has no dependencies other than Python3, and we'll need to remove xbacklight from Xorg Apps. I propose putting acpilight after Xorg Apps though.

Change History (22)

comment:1 by Douglas R. Reno, 20 months ago

Owner: changed from blfs-book to Douglas R. Reno
Status: newassigned

comment:2 by Xi Ruoyao, 20 months ago

Severity: normalblocker

It should be a better solution than adding xf86-intel back because the latter won't solve the issue with latest Intel GPUs (those come with 12 or 13-th gen Core processors) or NVIDIA/AMD GPUs.

Setting severity to blocker because we'd definitely want to solve it out before 12.0. If not we need to add xf86-intel back for now as an imperfect solution.

in reply to:  2 comment:3 by Douglas R. Reno, 20 months ago

Replying to Xi Ruoyao:

It should be a better solution than adding xf86-intel back because the latter won't solve the issue with latest Intel GPUs (those come with 12 or 13-th gen Core processors) or NVIDIA/AMD GPUs.

Setting severity to blocker because we'd definitely want to solve it out before 12.0. If not we need to add xf86-intel back for now as an imperfect solution.

I definitely agree with putting it as a blocker. I'll try to have this done and tested over the weekend. Just adding back xf86-video-intel is definitely not an ideal solution

comment:4 by Xi Ruoyao, 20 months ago

One challenge here is we need to figure out which packages use xbacklight.

comment:5 by Bruce Dubbs, 20 months ago

I have commented out xbacklight from the xorg applications page.

comment:6 by Xi Ruoyao, 20 months ago

I'm wondering if we are misdiagnosing the issue. It looks like xfce-power-manager directly writes into /sys/class/backlight, instead of calling the xbacklight executable:

https://gitlab.xfce.org/xfce/xfce4-power-manager/-/blob/master/src/xfpm-backlight-helper.c

So why wouldn't it work w/o xf86-video-intel? Maybe a permission issue (and we just need a udev rule to set the permission properly)?

in reply to:  6 comment:7 by Xi Ruoyao, 20 months ago

Replying to Xi Ruoyao:

I'm wondering if we are misdiagnosing the issue. It looks like xfce-power-manager directly writes into /sys/class/backlight, instead of calling the xbacklight executable:

https://gitlab.xfce.org/xfce/xfce4-power-manager/-/blob/master/src/xfpm-backlight-helper.c

So why wouldn't it work w/o xf86-video-intel? Maybe a permission issue (and we just need a udev rule to set the permission properly)?

Hmm, it looks like xfce-power-manager invokes xfpm-backlight-helper if XrandR does not work, and xfpm-backlight-helper is ran with pkexec so polkit is needed. There is a build time check so it's not a simple runtime dependency.

And I'm not sure if using polkit will cause a password prompt to show up for each time pressing the brightness up/down hotkey (it will be very stupid).

comment:8 by Xi Ruoyao, 20 months ago

There's a shipped polkit rule so the password prompt should not pump up for each brightness adjust:

https://gitlab.xfce.org/xfce/xfce4-power-manager/-/blob/master/src/org.xfce.power.policy.in.in

So perhaps we just need to prompt polkit from optional to recommended for xfce-power-manager.

comment:9 by Douglas R. Reno, 20 months ago

Polkit is recommended for elogind on SysV and systemd. It should already be present.

comment:10 by Xi Ruoyao, 20 months ago

Do we need to --enable-polkit or --with-polkit manually? I'm not sure.

comment:11 by Xi Ruoyao, 20 months ago

Summary: Replace xbacklight with acpilightFix backlight control for XFCE with non-Intel xorg video driver

in reply to:  9 ; comment:12 by Xi Ruoyao, 20 months ago

Replying to Douglas R. Reno:

Polkit is recommended for elogind on SysV and systemd. It should already be present.

For logind polkit is a runtime dependency, but xfce-power-manager checks it at build time. If polkit does not exist the routine controlling /sys/class/backlight will not be built.

comment:13 by Xi Ruoyao, 20 months ago

Type: enhancementdefect

comment:14 by Rahul Chandra, 20 months ago

Can confirm, building xfce4-power-manager without polkit kills the backlight keys in xfce4 (Testing with UHD 620 under modesetting). Curiously it also starts tearing under the normal compositor, which didn't happen with the intel driver, but that can be solved using the patch we have for Xorg and adding 20-intel.conf with the

Section "Device"
   Identifier "Graphics Adapter" 
   Driver "modesetting"
   Option "TearFree" "true"
EndSection
Last edited 20 months ago by Rahul Chandra (previous) (diff)

comment:15 by Douglas R. Reno, 20 months ago

UPower requires polkit, and UPower is a required dependency for xfce4-power-manager

Last edited 20 months ago by Douglas R. Reno (previous) (diff)

in reply to:  15 comment:16 by Xi Ruoyao, 20 months ago

Replying to Douglas R. Reno:

UPower requires polkit, and UPower is a required dependency for xfce4-power-manager

But the fact seems not. In upower NEWS:

Version 0.99.1 (Released: 2014-08-18)

New Features:

  • Remove unused polkit dependency (Eric Koegel, Martin Pitt)

comment:17 by Xi Ruoyao, 20 months ago

I've made the following change:

Leaving this open until a confirmation from Tim.

Last edited 20 months ago by Xi Ruoyao (previous) (diff)

in reply to:  12 comment:18 by Xi Ruoyao, 20 months ago

Replying to Xi Ruoyao:

Replying to Douglas R. Reno:

Polkit is recommended for elogind on SysV and systemd. It should already be present.

For logind polkit is a runtime dependency, but xfce-power-manager checks it at build time. If polkit does not exist the routine controlling /sys/class/backlight will not be built.

Nope. It is a runtime dependency. Even if polkit does not exist at build time, polkit-based backlight control is still built (unless explicitly --disable-polkit). See d5a105a. But in current BLFS polkit is no longer a runtime dependency of logind, and I'm inclined to demote it to optional for systemd too (it's only used when you run "systemctl" or "shutdown" etc. as a non-root user).

In XFCE polkit should be pick up by xfce4-session (it lists polkit-gnome as a recommended dependency) but my XFCE build works perfectly fine (including the backlight control) even though I deviated from the book (with polkit built after XFCE, and polkit-gnome not built at all). So maybe Tim has deviated from the book like I do, and the other people just FBBG so they cannot reproduce the issue at all.

Last edited 20 months ago by Xi Ruoyao (previous) (diff)

comment:19 by Xi Ruoyao, 20 months ago

To me it seems like xfce4-session only need polkit at build time for system shutdown without elogind. But I really don't want to test a "no-logind" system.

comment:20 by Xi Ruoyao, 20 months ago

I'm inclined to close this as fixed if no objection?

comment:21 by Douglas R. Reno, 20 months ago

Resolution: fixed
Status: assignedclosed

As part of this ticket, I decided to test backlight control in all of the desktop environments that we carry.

These were the results...

  • LXQt: Needs to be done via panel applet, but works perfectly
  • XFCE4: Needs to have handling of the brightness key turned on, but works great
  • LXDE: No backlight control whatsoever. Note about that added at eecfba74b64b811b51830b05362f0411c6df9684
  • GNOME: Works great
  • Plasma: Works great

Last night I built all of GNOME, and today I built all of the other DEs with the exception of LXDE.

This ticket can now be safely closed.

For context, the reason why I originally objected is that the brightness keys are handled differently on Dell Latitude laptops in comparison to most other brands, and the original report from Tim did involve a similar Dell Latitude to the one that I have.

in reply to:  21 comment:22 by Xi Ruoyao, 20 months ago

Replying to Douglas R. Reno:

As part of this ticket, I decided to test backlight control in all of the desktop environments that we carry.

These were the results...

  • LXQt: Needs to be done via panel applet, but works perfectly
  • XFCE4: Needs to have handling of the brightness key turned on, but works great

For the record:

  1. If we don't turn on it we can still adjust brightness by using the mouse to drag the setting slide bar.
  2. If D-Bus is not (re)built with Xorg libraries support, XFCE4 will hang if handling of the brightness key turned on and we press a brightness key.
Note: See TracTickets for help on using tickets.