panel_power_savings resets brightness to max after sleep with screen off
Brief summary of the problem:
Turning off the display (by setting the CRTC ACTIVE
property to 0 through KMS), suspending (S3) while the screen is off, then enabling panel_power_savings
causes the display backlight to reset to max brightness. If panel_power_savings
was enabled before suspend, then brightness is reset to max immediately after resume.
This causes brightness to be reset to max after resuming from suspend in GNOME, because gnome-settings-daemon
turns off the display before suspending.
Hardware description:
Lenovo ThinkPad E15 Gen 2
- CPU: AMD Ryzen 7 4700U with Radeon Graphics
- GPU:
04:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1636] (rev c2)
- System Memory: 16GB DDR4 3200 MHz
- Display(s): Laptop screen 1920x1080
- Type of Display Connection: eDP
System information:
- Distro name and Version: Arch Linux
- Kernel version:
Linux filip-e15 6.9.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 04:32:50 +0000 x86_64 GNU/Linux
- Custom kernel: N/A
- AMD official driver version: N/A
How to reproduce the issue:
- Download the attached test program: bug.c
- Compile with
gcc $(pkg-config --cflags --libs libdrm) bug.c -o bug
- Run the following commands as root from the Linux VT console (either Case 1 or Case 2)
panel_power_savings
enabled after suspend):
Case 1 (# disable panel_power_savings
echo 0 >/sys/class/drm/card1-eDP-1/amdgpu/panel_power_savings
# run test program
./bug
# at this point, brightness is still at its original value
# enable panel_power_savings
echo 1 >/sys/class/drm/card1-eDP-1/amdgpu/panel_power_savings
# brightness is now reset to max
panel_power_savings
enabled before suspend):
Case 2 (# enable panel_power_savings
echo 1 >/sys/class/drm/card1-eDP-1/amdgpu/panel_power_savings
# run test program
./bug
# brightness is now reset to max
bug.c
does:
What First the ACTIVE
property of all CRTCs is set to 0, then rtcwake -m mem -s 1
is executed, and then the ACTIVE
property is restored to original value.
Attached files:
Test program: bug.c
Additional information
If the brightness is manually changed after running the test program but before enabling panel_power_savings
, it will not be reset to max.
The change to max brightness is reflected in the sysfs backlight actual_brightness
attribute, but not in the brightness
attribute.
This issue is similar to #3086, but there are two key differences:
- this issue only occurs when the system is suspended (to S3) while the display is off
- this issue occurs only if
panel_power_savings
is used, which wasn't even supported by the kernel version in #3086