https://bugs.kde.org/show_bug.cgi?id=528781
Bug ID: 528781
Summary: Make brightness scale (linear or perceptual) and
minimum value configurable per-device by the user
Classification: Plasma
Product: plasmashell
Version First 6.7.5
Reported In:
Platform: Kubuntu
OS: Linux
Status: REPORTED
Severity: wishlist
Priority: NOR
Component: Power management & brightness
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: 1.0
Created attachment 198420
--> https://bugs.kde.org/attachment.cgi?id=198420&action=edit
Video demonstrating Thinkbook 16p Gen 4's brightness slider behavior when in
Optimus mode
DESCRIPTION
The mapping between the brightness shortcut keys (or the brightness slider) and
the raw backlight values (e.g.
/sys/class/backlight/nvidia_wmi_ec_backlight/brightness) is linear. On some
devices, this is problematic since the mapping between raw backlight values to
actual physical brightness is also linear (as far as I can tell). So the same
amount of brightness percentage change (e.g. 5%) is perceptually huge when the
current brightness is very low, and nearly negligible when brightness is very
high. The brightness slider is still barely usable on a laptop whose maximum
brightness is 500nit in dark areas, but as mentioned in Bug 448459, it's
probably not usable for field survey laptops with 1400nit maximum brightness.
So PowerDevil should arguably apply a perceptual mapping between the brightness
slider and raw backlight values.
The attachment shows my Thinkbook 16p Gen 4's brightness slider behavior when
in Optimus mode. It is deliberately recorded with auto exposure on. You can
observe how its perceptual brightness jump between 1% and 2% is even
significantly large than the one between 95% and 100%. And when brightness is
0%, the backlight literally turns off.
This is the problem behind Bug 448459 (RESOLVED INTENTIONAL) and
https://invent.kde.org/plasma/powerdevil/-/merge_requests/134. The problem has
not been actually solved for years mainly due to concerns about how we should
reliably check whether a perceptual mapping is truly needed on PowerDevil's
side, since on certain other devices, perceptual mappings will be transparently
applied by the backlight driver, the EC or the panel hardware without
PowerDevil even knowing, and blindly applying an extra perceptual mapping on
them will result in double-correction. So my proposal is deliberately
different:
* Do not attempt to automatically tell whether the device needs perceptual
mapping.
* Keep the default behavior (linear mapping, minimum raw backlight value is 1)
absolutely unchanged, so we will not silently break anyone's experience.
* Expose user-configurable two user configurable settings in System Settings ->
Power Management -> Advanced, stored per backlight device name (e.g.
nvidia_wmi_ec_backlight), namely the brightness scale correction
(linear/perceptual, default to "linear") and the minimum raw brightness value
(default to 1, but if 1 still turns the backlight off, the user can set a
higher value; and allow the user to set it to 0 if the user considers turning
backlight off a useful feature).
Pushing the decision about the brightness scale to the user is arguably the
only practical way to get this fixed, since for my Thinkbook 16p Gen 4, I get
the following results:
* In Optimus mode: backlight device is
/sys/class/backlight/nvidia_wmi_ec_backlight, max_brightness is 800, mapping is
linear (as shown in the video), and setting to 0% (`cat $DEVICE/brightness` ->
1) literally turns off the backlight. `cat $DEVICE/scale` yields "unknown".
* In dGPU-only mode (set in the UEFI options): backlight device is
/sys/class/backlight/nvidia_0, max_brightness is 100, mapping is perceptual and
mostly intuitive, where 70% brightness here corresponds roughly to 30% in
Optimus mode. Setting to 0% (`cat $DEVICE/brightness` -> 1) does not turn off
the backlight. `cat $DEVICE/scale` yields "unknown".
This necessarily means that we cannot automatically tell whether a perceptual
mapping is needed on PowerDevil's side in a reliable manner. Conditioning on
`$DEVICE/scale` does not help — both modes I tested above has scale=unknown.
Conditioning on `$DEVICE/max_brightness` somehow works but is obviously
fragile. Device-specific quirk databases keyed on the device model or panel
EDID will not help either — both mode I tested are on the same device and the
same panel, just different GPU wiring modes. The only guaranteed safe option is
to keep default behavior unchanged and instead let the users judge whether an
extra perceptual mapping is needed themselves. Furthermore, in Optimus mode on
my device, setting raw brightness value to 1 (not 0) still turns off the
backlight, and the safe minimum raw brightness value that does not turn
backlight off, as I have tested, is 4. That's why I think the minimum raw
brightness value should also be made configurable.
STEPS TO REPRODUCE
Only definitely applicable for Thinkbook 16p Gen 4, but this is not the only
affected model as far as I know.
1. Switch to Optimus (mixed GPU) mode in UEFI options.
2. Boot to desktop.
3. Press Fn+F5 (or whatever your "brightness down" shortcut key is) to lower
the brightness to 0%. Observe whether the backlight turns off completely. If it
turns off completely, you can run `echo <value> | sudo tee
"$DEVICE/brightness"` to find out the minimum raw brightness value (>1) that
does not turn the backlight off.
4. Press Shift+Fn+F6 (or whatever your "brightness up by 1%" shortcut key is)
to increase brightness gradually, 1% at a time. Observe how large the
perceptual difference between 1% and 2% brightness is.
5. Press Fn+F6 (or whatever your "brightness up" shortcut key is) to increase
brightness 5% at a time. Observe how the perceptual brightness change
corresponding to a 5% jump gradually gets more and more negligible (or keeps
consistent) as the brightness increases.
6. Tune back to normal brightness.
7. Run `echo /sys/class/backlight/* && cat /sys/class/backlight/*/scale` to see
the backlight device name and the its advertised brightness scale.
8. Reboot. Switch to dGPU-only mode and re-perform the procedure above. Observe
that backlight will not turn off even when brightness is set to 0%, and how the
perceptual brightness change corresponding to each 5% jump stays largely
consistent as the brightness increases.
OBSERVED RESULT
* Optimus mode: device is nvidia_wmi_ec_backlight, backlight off at 0% (minimum
raw value that does not turn backlight off is 4), slider is nearly linear and
perceptually inconsistent, advertised scale is "unknown".
* dGPU-only mode: device is nvidia_0, backlight not off at 0%, slider is
largely perceptually consistent, advertised scale is "unknown".
EXPECTED RESULT
Default behavior is still identical as the "OBSERVED RESULT". But when I find
that the brightness mapping is undesirable, I will have a way to configure
PowerDevil to apply an extra perceptual correction for nvidia_wmi_ec_backlight,
and to allow raw brightness value only as low as 4, not 1, while keeping the
behavior on nvidia_0 still untouched at all.
SOFTWARE/OS VERSIONS
Operating System: Kubuntu 26.10
KDE Plasma Version: 6.7.5
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.2
ADDITIONAL INFORMATION
I am thinking about submitting a patch for this, so I'm posting here to agree
with the approach before doing so; but I cannot promise an ETA due to lack of
free time, so feel free to implement this if I have not yet. I am happy to test
patches on this hardware (both Optimus and dGPU-direct modes).
--
You are receiving this mail because:
You are watching all bug changes.