Bug 1202125 - Unable to change display brightness through brightness keys or applet slider.
Unable to change display brightness through brightness keys or applet slider.
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: X.Org
Current
x86-64 openSUSE Tumbleweed
: P3 - Medium : Normal (vote)
: ---
Assigned To: Gfx Bugs
Gfx Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-08-03 23:11 UTC by Vittorio Basile
Modified: 2022-08-11 14:08 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
hwinfo (872.29 KB, text/plain)
2022-08-05 11:46 UTC, Vittorio Basile
Details
dmesg (76.08 KB, text/plain)
2022-08-05 11:47 UTC, Vittorio Basile
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Basile 2022-08-03 23:11:16 UTC
Hello there.
After installing openSUSE Tumbleweed on my partner's laptop (Lenovo IdeaPad Flex 15D with an AMD A6 APU (with ATI Radeon HD 8400 graphics processor)), I noticed that the display brightness is so low and I can't change it at all, not through the brightness keys on the keyboard, nor through the display brightness slider in the power management applet. I am on XFCE4 and with the latest kernel 5.18.12-1-default. The curious thing is that I noticed this exact same behaviour (brightness stuck at previous state) on my own Lenovo ThinkPad as well. But rolling back BTRFS snapshot to previous kernel version (5.18.11-1-default) fixed the issue and brightness keys and brightness slider were working as expected again, so I now know that this is a kernel bug of 5.18.12-1-default. Now, I  managed to downgrade the kernel on the Lenovo IdeaPad Flex 15D by downloading it from an archive of recent Tumbleweed snapshots, but the problem was still there, nothing changed at all, so I thought I potentially missed on some other packages needed to solve the issue, that don't come bundled with the kernel (like some additional firmware or other similar stuff), but downgrading kernel version to the previous one on my Lenovo ThinkPad definitely solves this issue, as I said before, after the upgrade even the ThinkPad started behaving the same way, but downgrading to a previous snapshot helped.

I am more than happy to give you logs or additional troubleshooting information that you might need. I just hope that you can help me get rid of this annoyance for my partner. 

I thank you all very much for your attention
Comment 1 Takashi Iwai 2022-08-04 11:52:05 UTC
First off, could you verify whether the problem persists with the latest OBS Kernel:stable kernel?  Currently it's 5.18.15, and it should move to 5.19 in tomorrow, supposedly.  Note that it's an unofficial build, hence you'd need to disable Secure Boot.

If the problem is still there with the latest Kernel:stable, please upload the hwinfo output and the dmesg output to Bugzilla.
Comment 2 Vittorio Basile 2022-08-04 22:47:19 UTC
Ok. So with the OBS kernel (5.18.15) default the system wouldn't even boot at all. It said something about the touchpad not being recognised or something like that.

So, here are pastebins for hwinfo and dmesg.

hwinfo: https://paste.opensuse.org/40483401
dmesg: https://paste.opensuse.org/25075829
Comment 3 Takashi Iwai 2022-08-05 05:50:32 UTC
Could you upload to Bugzilla (use attachments) instead?

Also, check the 5.19 kernel in OBS Kernel:HEAD repo, too.
Comment 4 Vittorio Basile 2022-08-05 11:46:46 UTC
Created attachment 860638 [details]
hwinfo
Comment 5 Vittorio Basile 2022-08-05 11:47:29 UTC
Created attachment 860639 [details]
dmesg
Comment 6 Takashi Iwai 2022-08-05 13:00:04 UTC
Thanks.  The machine is with radeon driver, and it seems having a sysfs backlight control.

Could you check the entries in /sys/class/backlight/*?  If there is a directory (usually a symlink), go to there, and check the content of "brightness" and "max_brightness" there.  i.e.
  % cat /sys/class/backlight/*/brightness
  % cat /sys/class/backlight/*/max_brightness

Then try to change the value by writing to */brightness (as root): e.g.
  % su
  # echo 50 > /sys/class/backlight/*/brightness

Does this change the backlight level?
Comment 7 Vittorio Basile 2022-08-05 14:27:28 UTC
cat /sys/class/backlight/*/brightness ---> 12
cat /sys/class/backlight/*/max_brightness ---> 255

I remember changing the value of brightness as sudo once and it did change the brightness BUT, as soon as I would do a reboot it would just freeze at the Tumbleweed loading logo with no apparent errors or warnings in the bootstrap. 

Anyway, this time around changing the value to 50 in the brightness file did increase the display brightness indeed like last time and it also updates the brightness slider in the brightness (power management) applet. But still the brightness keys and slider didn't respond at all.

Upon reboot this time, it gets to the XFCE4 desktop, and it stuck at the display brightness of '50' as set before reboot. Again, I cannot alter it unless I go through this manual method...
Comment 8 Takashi Iwai 2022-08-05 14:31:55 UTC
(In reply to Vittorio  Basile from comment #7)
> cat /sys/class/backlight/*/brightness ---> 12
> cat /sys/class/backlight/*/max_brightness ---> 255
> 
> I remember changing the value of brightness as sudo once and it did change
> the brightness BUT, as soon as I would do a reboot it would just freeze at
> the Tumbleweed loading logo with no apparent errors or warnings in the
> bootstrap. 
> 
> Anyway, this time around changing the value to 50 in the brightness file did
> increase the display brightness indeed like last time and it also updates
> the brightness slider in the brightness (power management) applet. But still
> the brightness keys and slider didn't respond at all.
> 
> Upon reboot this time, it gets to the XFCE4 desktop, and it stuck at the
> display brightness of '50' as set before reboot. Again, I cannot alter it
> unless I go through this manual method...

So, this doesn't look like a kernel problem.  Writing your favorite level to the sysfs should change the current brightness, and this is the only interface the kernel provides.  The rest is the user-space implementation, and that's likely the missing piece for radeon.

Note that systemd remembers the last brightness at reboot/shutdown time, and tries to restore it at the next boot.  That's why it sticks with 50.  If you reboot after changing to a higher value, it'll be restored at the next reboot.

I thought that is should be possible to specify the backlight device entry in X11 config.  I'm not sure whether radeon also allows it, though.

In anyway, as it's rather an issue of X, reassigned.
Comment 9 Vittorio Basile 2022-08-05 14:40:58 UTC
(In reply to Takashi Iwai from comment #8)
> (In reply to Vittorio  Basile from comment #7)
> > cat /sys/class/backlight/*/brightness ---> 12
> > cat /sys/class/backlight/*/max_brightness ---> 255
> > 
> > I remember changing the value of brightness as sudo once and it did change
> > the brightness BUT, as soon as I would do a reboot it would just freeze at
> > the Tumbleweed loading logo with no apparent errors or warnings in the
> > bootstrap. 
> > 
> > Anyway, this time around changing the value to 50 in the brightness file did
> > increase the display brightness indeed like last time and it also updates
> > the brightness slider in the brightness (power management) applet. But still
> > the brightness keys and slider didn't respond at all.
> > 
> > Upon reboot this time, it gets to the XFCE4 desktop, and it stuck at the
> > display brightness of '50' as set before reboot. Again, I cannot alter it
> > unless I go through this manual method...
> 
> So, this doesn't look like a kernel problem.  Writing your favorite level to
> the sysfs should change the current brightness, and this is the only
> interface the kernel provides.  The rest is the user-space implementation,
> and that's likely the missing piece for radeon.
> 
> Note that systemd remembers the last brightness at reboot/shutdown time, and
> tries to restore it at the next boot.  That's why it sticks with 50.  If you
> reboot after changing to a higher value, it'll be restored at the next
> reboot.
> 
> I thought that is should be possible to specify the backlight device entry
> in X11 config.  I'm not sure whether radeon also allows it, though.
> 
> In anyway, as it's rather an issue of X, reassigned.

Oh ok, sorry, I'm not that technical to determine if it was due to a kernel or user-space issue. I just thought it was kernel as it also was happening on my other laptop and when I downgraded kernel version it did fix it on my own laptop. Ok, do you know how could I tell X11 to bind the brightness keys and and applet slider to actually changing the brightness values? I wouldn't know how to do it myself. I have no idea if radeon allows it or not either.

Thank you very much for all your help by the way, I increased the value to 130 and now at least it doesn't look stupidly dim lol, and workable. But I'd like to finish fixing the keys not responding issue. Cheers :)
Comment 10 Vittorio Basile 2022-08-05 14:46:02 UTC
P.s. But of course I also rolled back an entire snapshot, so it is possible that there were other packages involved as well and not just the kernel.
Comment 11 Stefan Dirsch 2022-08-05 14:50:42 UTC
I'm not aware of any option for setting an initial backlight level via X user drivers "radeon" or "amdgpu". Maybe XFCE can set the backlight level. There is a xfce4-power-manager-plugin package available.

Xfce Panel Plugin for Monitoring Batteries and Changing the Display Brightness

This package provides a plugin for the Xfce panel for monitoring battery and
device charge levels and to regulate display brightness.

Maybe you can have a try with that and it can save the current settings and restore once you login again.
Comment 12 Vittorio Basile 2022-08-05 14:58:23 UTC
(In reply to Stefan Dirsch from comment #11)
> I'm not aware of any option for setting an initial backlight level via X
> user drivers "radeon" or "amdgpu". Maybe XFCE can set the backlight level.
> There is a xfce4-power-manager-plugin package available.
> 
> Xfce Panel Plugin for Monitoring Batteries and Changing the Display
> Brightness
> 
> This package provides a plugin for the Xfce panel for monitoring battery and
> device charge levels and to regulate display brightness.
> 
> Maybe you can have a try with that and it can save the current settings and
> restore once you login again.

When I said about the brightness slider, that's exactly what I was talking about (the xfce4 power applet menu), inside there, there is a slider to change the brightness but it just doesn't work and upon closing and reopening it resets back to the value the brightness is set. But dragging the slider doesn't do anything :/
Comment 13 Takashi Iwai 2022-08-05 15:12:27 UTC
Hmm, if it's about XFCE, you can try manual calls like:

% /usr/sbin/xfpm-power-backlight-helper --get-max-brightness

% /usr/sbin/xfpm-power-backlight-helper --get-brightness

for getting the max and current brightness values.  Those can run as normal user.  For setting the value, though, it needs to be wrapped with pkexec like:

% pkexec /usr/sbin/xfpm-power-backlight-helper --set-brightness 200

If this doesn't work, the problem is in either pkexec or xfpm-backlight-helper stuff.  If this works, but the xfce power manager can't change, it's some problem between xfce pm and its helper.
Comment 14 Vittorio Basile 2022-08-05 18:17:52 UTC
Ok, I haven't even followed the steps here, I noticed there were quite a few updates and after screwing a little thing up, and chrooting with a rescue drive as couldn't login to the system anymore and the filesystem was in read-only state I finally managed to execute a sudo zypper ref && sudo zypper dup and there kept the 5.19 kernel but noticed there was also a Mesa update alongside Mesa vulkan and others, thought that might be a potential cause, rebooted after executing the update and.....tadaaaaaa the brightness keys on the keyboard and the power manager applet menu with the brightness slider work fantastically now!!! So it was obviously a bug in the graphic stack of Mesa or something related to that kind of stuff.

Anyway, I would like to thank all of you again for taking the time to help me. I really appreciate it. You guys rock :)
Comment 15 Stefan Dirsch 2022-08-06 07:56:56 UTC
Ok. So let's close the ticket as Fixed.
Comment 16 OBSbugzilla Bot 2022-08-11 12:50:07 UTC
This is an autogenerated message for OBS integration:
This bug (1202125) was mentioned in
https://build.opensuse.org/request/show/994507 Factory / xfce4-power-manager