BUG: Restoring brightness with systemd-backlight doesn't work on Linux 5.9(.1)

Leonidas-Panagiotis Papadakos papadakospan at gmail.com
Mon Oct 19 10:11:26 UTC 2020


Hi,

I have a Lenovo laptop (L340-17API) which uses an AMD chip for graphics:
04:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI]
Picasso [1002:15d8] (rev c2)

It seemed that everything was fine with systemd-backlight before AMD decided to
mix using 16-bit and 8-bit values...

Now it seems that this was tackled here
(https://bugzilla.kernel.org/show_bug.cgi?id=203905) and indeed I don't get this
issue anymore, using 5.9 and now 5.9.1 on Arch Linux:
Οκτ 07 15:08:56 L340 systemd-backlight[333]: amdgpu_bl0: Saved brightness 22359
too high; decreasing to 255.

I don't know if this is related to the 16-bit bug anymore, but I do get this
when I boot the laptop:

Οκτ 19 12:04:06 L340 systemd[1]: Starting Load/Save Screen Backlight Brightness
of backlight:amdgpu_bl0...
Οκτ 19 12:04:06 L340 systemd[1]: systemd-backlight at backlight:amdgpu_bl0.service:
Main process exited, code=exited, status=1/FAILURE
Οκτ 19 12:04:06 L340 systemd[1]: systemd-backlight at backlight:amdgpu_bl0.service:
Failed with result 'exit-code'.
Οκτ 19 12:04:06 L340 systemd[1]: Failed to start Load/Save Screen Backlight
Brightness of backlight:amdgpu_bl0.

dmesg gives me this trace:
[  +0,000025] ------------[ cut here ]------------
[  +0,000133] WARNING: CPU: 0 PID: 15 at
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:2548
dc_link_set_backlight_level+0x8a/0xf0 [amdgpu]
[  +0,000003] Modules linked in: ac(+) acpi_cpufreq(+) tcp_bbr tcp_lp
pkcs8_key_parser sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16
mbcache jbd2 serio_raw atkbd libps2 amdgpu crc32c_intel xhci_pci
xhci_pci_renesas xhci_hcd i8042 serio gpu_sched i2c_algo_bit ttm drm_kms_helper
syscopyarea sysfillrect sysimgblt fb_sys_fops cec rc_core drm agpgart
[  +0,000020] CPU: 0 PID: 15 Comm: kworker/0:1 Not tainted 5.9.1-arch1-1 #1
[  +0,000002] Hardware name: LENOVO 81LY/LNVNB161216, BIOS ARCN34WW 05/20/2020
[  +0,000005] Workqueue: kacpi_notify acpi_os_execute_deferred
[  +0,000112] RIP: 0010:dc_link_set_backlight_level+0x8a/0xf0 [amdgpu]
[  +0,000002] Code: 70 03 00 00 31 c0 48 8d 96 c0 01 00 00 48 8b 0a 48 85 c9 74
06 48 3b 59 08 74 20 83 c0 01 48 81 c2 d8 04 00 00 83 f8 06 75 e3 <0f> 0b 45 31
e4 5b 44 89 e0 5d 41 5c 41 5d 41 5e c3 48 98 48 69 c0
[  +0,000001] RSP: 0018:ffffb8b70014fcc0 EFLAGS: 00010246
[  +0,000002] RAX: 0000000000000006 RBX: ffffa20ff023fc00 RCX: 0000000000000000
[  +0,000001] RDX: ffffa20fee041ed0 RSI: ffffa20fee040000 RDI: 0000000000000000
[  +0,000001] RBP: ffffa20fecd90000 R08: 0000000000000004 R09: 0000000000000001
[  +0,000001] R10: ffffa20ff68f53a8 R11: 0000000000000000 R12: 0000000000000401
[  +0,000001] R13: 0000000000000000 R14: 0000000000000404 R15: 00000000ffffffff
[  +0,000002] FS:  0000000000000000(0000) GS:ffffa20ff8a00000(0000)
knlGS:0000000000000000
[  +0,000001] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  +0,000001] CR2: 00007ffd5954be50 CR3: 00000001b5442000 CR4: 00000000003506f0
[  +0,000002] Call Trace:
[  +0,000119]  amdgpu_dm_backlight_update_status+0xb4/0xc0 [amdgpu]
[  +0,000005]  backlight_device_set_brightness+0x7e/0x130
[  +0,000107]  amdgpu_acpi_event+0x1fb/0x270 [amdgpu]
[  +0,000006]  blocking_notifier_call_chain+0x5d/0x80
[  +0,000003]  acpi_notifier_call_chain+0xa0/0xe0
[  +0,000005]  acpi_video_bus_notify+0x139/0x1d0
[  +0,000003]  acpi_ev_notify_dispatch+0x4a/0x5f
[  +0,000002]  acpi_os_execute_deferred+0x16/0x20
[  +0,000003]  process_one_work+0x1da/0x3d0
[  +0,000002]  worker_thread+0x4d/0x3d0
[  +0,000002]  ? rescuer_thread+0x410/0x410
[  +0,000002]  kthread+0x142/0x160
[  +0,000002]  ? __kthread_bind_mask+0x60/0x60
[  +0,000003]  ret_from_fork+0x22/0x30
[  +0,000003] ---[ end trace d03f36eba464d928 ]---

If I restart systemd-backlight at backlight:amdgpu_bl0.service it works fine, and
restores the previous backlight level, so looking at this forum post
(https://archlinux.org.ru/forum/topic/20262/?page=1#post-235818) I edited the
service like so:

#
/etc/systemd/system/systemd-backlight at backlight:amdgpu_bl0.service.d/override.co
nf
[Service]
Restart=on-failure
RestartSec=5s

Now I get this at boot (fails, then works):
Οκτ 19 12:32:11 L340 systemd[1]: Starting Load/Save Screen Backlight Brightness
of backlight:amdgpu_bl0...
Οκτ 19 12:32:11 L340 systemd[1]: systemd-backlight at backlight:amdgpu_bl0.service:
Main process exited, code=exited, status=1/FAILURE
Οκτ 19 12:32:11 L340 systemd[1]: systemd-backlight at backlight:amdgpu_bl0.service:
Failed with result 'exit-code'.
Οκτ 19 12:32:11 L340 systemd[1]: Failed to start Load/Save Screen Backlight
Brightness of backlight:amdgpu_bl0.
Οκτ 19 12:32:16 L340 systemd[1]: systemd-backlight at backlight:amdgpu_bl0.service:
Scheduled restart job, restart counter is at 1.
Οκτ 19 12:32:16 L340 systemd[1]: Stopped Load/Save Screen Backlight Brightness
of backlight:amdgpu_bl0.
Οκτ 19 12:32:16 L340 systemd[1]: Starting Load/Save Screen Backlight Brightness
of backlight:amdgpu_bl0...
Οκτ 19 12:32:16 L340 systemd[1]: Finished Load/Save Screen Backlight Brightness
of backlight:amdgpu_bl0.

I have tried acpi_backlight=video and native but then the systemd-backlight
service finishes successfully, "restoring" max brightness.




More information about the amd-gfx mailing list