Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxqt-backlight: Discrepancy in reading and writing of brightness #263

Open
hch12907 opened this issue Jul 18, 2020 · 0 comments · May be fixed by #264
Open

lxqt-backlight: Discrepancy in reading and writing of brightness #263

hch12907 opened this issue Jul 18, 2020 · 0 comments · May be fixed by #264

Comments

@hch12907
Copy link

hch12907 commented Jul 18, 2020

lxqt-backlight gets the brightness value from /sys/class/backlight/*/actual_brightness instead of /sys/class/backlight/*/brightness and then proceeds to write the processed actual_brightness into brightness. (Not like you have the permission to write into actual_brightness anyway...)

This is fine actually, but amdgpu_bl0 returns the raw brightness value (0-65536) for actual_brightness while brightness accepts only values between zero to max_brightness which is 255. When lxqt-backlight writes the processed actual_brightness to brightness, the brightness gets ramped up to 100% as the processed raw values are often in the range of 10000 to 20000, which get clamped to 255 when written to brightness.

Interestingly, this behaviour is not observed when one sets a brightness value directly - it only occurs when one increases or decreases the brightness through lxqt-config-brightness -i/-d. lxqt-config-brightness -s 20 and pkexec lxqt-backlight_backend 20 % does what one would expect: setting the brightness value to 20% of the maximum. This is because both of them do level / 100 * max_brightness instead of actual_brightness and hence is not affected by the bug.

Expected Behavior

The brightness value should be obtained from /sys/class/backlight/*/brightness.

Current Behavior

The brightness value is obtained from /sys/class/backlight/*/actual_brightness.

Possible Solution

For raw drivers, read from brightness instead of actual_brightness. I'm not sure about the other driver types.

Steps to Reproduce (for bugs)

1. Have a laptop with an integrated AMD GPU. Raven Ridge (Vega 7) in my case.
2a. Attempt to increase/decrease the brightness value, and blind your eyes. (lxqt-config-brightness)
2b. Attempt to increase/decrease the brightness value, and nothing happens. (lxqt-backlight_backend)
(lxqt-backlight_backend includes a check for value < max_value before writing to brightness)

System Information
  • Distribution & Version: Arch Linux (rolling)
  • Kernel: 5.7.8
  • Qt Version: 5.15.0-4
  • libqtxdg Version: 3.5.0
  • lxqt-build-tools Version: N/A
  • liblxqt version: 0.15.1-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant