BrightnessOutofRange: Actual brightness for amdgpu_bl0 not in range 0..255

Bug #1861925 reported by Ecker Sandor
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Pop!_OS
New
Undecided
Unassigned
linux (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

Hi,

I have a acer aspire a315-41 laptop, it has BIOS 1.15, Ubuntu 19.10, Kernel stock 5.3, and 5.5.0. I have a problem with the Backlight. I can not control.

According to: https://wiki.ubuntu.com/Kernel/Debugging/Backlight

It is : Backlight control does not work, but there are entries in /sys/class/backlight.

The problem is as far I could find:

sanya@Aspire-A315-41:/sys/class/backlight/amdgpu_bl0$ cat brightness
135
sanya@Aspire-A315-41:/sys/class/backlight/amdgpu_bl0$ cat actual_brightness
43500
sanya@Aspire-A315-41:/sys/class/backlight/amdgpu_bl0$ cat max_brightness
255

The brightness read from the HW is not in the range, and when I change the brightness by the keys the value in the brightness file changes too, but the actual_brightness is stuck at the value 43500...

I have tried all the steps mentioned in https://wiki.ubuntu.com/Kernel/Debugging/Backlight

Actually I have tried all these kernel startup parameter variants without luck:

GRUB_CMDLINE_LINUX_DEFAULT=""
#GRUB_CMDLINE_LINUX_DEFAULT="video.use_native_backlight=1"
#GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi="
#GRUB_CMDLINE_LINUX_DEFAULT="video.use_bios_initial_backlight=0"
#GRUB_CMDLINE_LINUX_DEFAULT="amdgpu.dcfeaturemask=0x4 amdgpu.abmlevel=2"
#GRUB_CMDLINE_LINUX_DEFAULT="acpi_backlight=video amdgpu.abmlevel=1"
#GRUB_CMDLINE_LINUX_DEFAULT="i8042.nopnp acpi_osi=Linux acpi_backlight=vendor"
#GRUB_CMDLINE_LINUX_DEFAULT="i8042.nopnp acpi_osi=! acpi_osi=\"Windows 2009\" acpi_backlight=vendor"
#GRUB_CMDLINE_LINUX_DEFAULT="i8042.nopnp acpi_osi=! acpi_osi=\"Windows 2009\" acpi_backlight=video"
#GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=! acpi_osi=\"Windows 2009\" acpi_backlight=vendor"
#GRUB_CMDLINE_LINUX_DEFAULT="i8042.nopnp acpi_osi=! acpi_osi=\"Windows 2009\" acpi_backlight=vendor"
#GRUB_CMDLINE_LINUX_DEFAULT="i8042.nopnp acpi_osi=! acpi_osi=\"Windows 2009\" acpi_backlight=vendor"

I guess the fwts has found also this as an error:

autobrightness: Automated LCD brightness test.
--------------------------------------------------------------------------------
Test 1 of 2: Test for maximum and actual brightness.
PASSED: Test 1, Maximum brightness for amdgpu_bl0 is 255 which is sane.
FAILED [HIGH] BrightnessOutofRange: Test 1, Actual brightness for amdgpu_bl0 not
in range 0..255.

Test 2 of 2: Change actual brightness.
FAILED [MEDIUM] BrightnessMismatch: Test 2, 256 brightness levels did not match
the brightnesss level just set for backlight amdgpu_bl0.
The failed brightness levels were: 0-255.

It would be great if someone could help set the HW brightness back to the normal range.

If you need any more debug files please let me know!

Thanks,
Regards,
Sandor

Revision history for this message
Ecker Sandor (esanya) wrote :
Revision history for this message
Ecker Sandor (esanya) wrote :

dmidecode

Revision history for this message
Ecker Sandor (esanya) wrote :

dsdt.dat

description: updated
Revision history for this message
Ecker Sandor (esanya) wrote :

acpidump

description: updated
Ecker Sandor (esanya)
description: updated
Revision history for this message
Ecker Sandor (esanya) wrote :
Ecker Sandor (esanya)
description: updated
affects: xserver-xorg-video-amdgpu (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Ecker Sandor (esanya) wrote :

I have tried the the points 1-16 in the document https://wiki.ubuntu.com/Kernel/Debugging/Backlight
but I think in the latest kernel (5.5++) some parameters are removed. https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html

Point 10: use_bios_initial_backlight is not found in:
https://www.kernel.org/doc/html/latest/search.html?q=use_bios_initial_backlight&check_keywords=yes&area=default

Point 11: https://www.kernel.org/doc/html/latest/search.html?q=use_native_backlight&check_keywords=yes&area=default#

On 5.6.rc1 the parameters for vide are under: /sys/module/video/parameters/
report_key_events
only_lcd
hw_changes_brightness
disable_backlight_sysfs_if
device_id_scheme
brightness_switch_enabled
allow_duplications

The problem is I have not found any documentation to these parameters too... :(

Revision history for this message
Alex Hung (alexhung) wrote :

I tried 19.10 and 20.04 (daily build) on an AMD platform (AMD Ryzen 5 2500U with Radeon Vega Graphics), and the backlight works without problems.

This platform has the same symptom as described in the bug description - actual_brightness is a fixed and higher value, and it does not change with brightness. The max_brightness is 255 (which is fixed in amdgpu driver) and brightness can be changed from 0 to 255.

I built a kernel, based on 5.6rc5, that has actual_brightness = brightness. It is available for testing @ https://people.canonical.com/~alexhung/LP1861925/poc_kernel/

The actual_brightness is read from hardware but it doesn't reflect actual brightness. Only AMD developers can answer why it doesn't work accordingly - perhaps different hardware has different address and this needs updating.

Revision history for this message
Alex Hung (alexhung) wrote :

In theory, max_brightness and brightness are all needed for backlight control. I am using stock Ubuntu 19.10 & 20.04 with gnome desktop. Are you using anything special?

Revision history for this message
Ecker Sandor (esanya) wrote :

I'm using stock Ubuntu _Mate_ 19.10. Do you think that some other Ubuntu derivate would be OK?

I have tried the stock kernel 5.3, 5.5, 5.6rc1. I will just try your kernel! Thanks!

Some more infos:
-if the brightness == max_brightness => the display is at max brightness but it does not flash.
-if the brightness < max_brightness => the display brightness is not stable (is flashing). the brightness is jumping back and fort to the value brightness and max_brightness

Revision history for this message
Ecker Sandor (esanya) wrote :

So I have tested your custom kernel. It does not fix my problem:

-if the brightness == max_brightness => the display is at max brightness but stable.
-if the brightness < max_brightness => the display brightness is not stable (is flashing). the brightness is jumping back and fort on the value brightness and max_brightness

But the values are as you described (actual_brightness is equal brightness)

Aspire-A315-41:/sys/class/backlight/amdgpu_bl0$ cat brightness
183
Aspire-A315-41:/sys/class/backlight/amdgpu_bl0$ cat actual_brightness
183
Aspire-A315-41:/sys/class/backlight/amdgpu_bl0$ cat max_brightness
255

Please tell me if I can test anything!

Actually I have an other laptop Asus 315-41, but with discrete GPU with the same OS, it has the also a large actual_brightness value, but the brightness control works (as you described with the laptops you tested)... I'm not sure how long the other laptop will work correctly... :(

Revision history for this message
Ecker Sandor (esanya) wrote :

uname -a:

Linux Aspire-A315-41 5.6.0-rc5-custom #8 SMP Tue Mar 10 04:01:57 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Alex Hung (alexhung) wrote :

I tried Ubuntu Mate 19.10 live on my testing system (AMD Ryzen 5 2500U with Radeon Vega Graphics - seems to be the same AMD CPU on your Acer), and brightness control works without any problems even though actual_brightness has a fixed and higher value.

The below is the latest function can be ftrace'd before setting brightness on my AMD platform.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c#L418

See result of using kprobe-perf (needs to be installed) with writing max (255) to brightness

$ sudo kprobe-perf 'p:dce_abm_set_backlight_level_pwm $arg1 $arg2 $arg3 $arg4 $arg5 '
Tracing kprobe dce_abm_set_backlight_level_pwm. Ctrl-C to end.
             tee-2074 [001] .... 1009.569878: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9874e0928900 arg2=0xffff arg3=0x0 arg4=0x0 arg5=0x0

Note the arg2 = 0xffff (max brightness) and arg5 = 0 (no "use_smooth_brightness")

If you observe the same behaiours but different results, the Acer hardware may have something special that needs attention either from Acer or from AMD...

Revision history for this message
Ecker Sandor (esanya) wrote :
Download full text (3.8 KiB)

So the backlight is set to 255 most of the time (because with that value it is stable)...
I have pressed the decrease and increase backlight buttons some times:

arg4 is different...
arg5 is 0x0 here too...

Aspire-A315-41:~$ sudo kprobe-perf 'p:dce_abm_set_backlight_level_pwm $arg1 $arg2 $arg3 $arg4 $arg5 '
Tracing kprobe dce_abm_set_backlight_level_pwm. Ctrl-C to end.
 mate-power-back-7094 [002] .... 4130.246969: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xf4fd arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7100 [002] .... 4140.650308: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xe9fb arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7106 [004] .... 4148.360022: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xf4fd arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7112 [006] .... 4150.064228: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xffff arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7117 [000] .... 4154.430645: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xf4fd arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7123 [000] .... 4156.020204: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xe9fb arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7129 [000] .... 4169.318284: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xf4fd arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7135 [003] .... 4171.173554: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xffff arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7141 [006] .... 4177.134779: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xf4fd arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7147 [000] .... 4178.988650: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xe9fb arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7152 [005] .... 4179.822378: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xdef9 arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7157 [003] .... 4180.801012: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xd3f7 arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7162 [003] .... 4181.676478: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xc8f5 arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7173 [004] .... 4186.458165: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x410 [amdgpu]) arg1=0xffff9cabd4c87800 arg2=0xd3f7 arg3=0x0 arg4=0x1 arg5=0x0
 mate-power-back-7179 [000] .... 4186.989282: dce_abm_set_backlig...

Read more...

Revision history for this message
Alex Hung (alexhung) wrote :

Does this system have two AMD graphic cards? can you please upload the output of "lspci -vvnn"?

Revision history for this message
Ecker Sandor (esanya) wrote :

As I told I have an other similar laptop with discrete GPU:
Product Name : Aspire A315-41G
With cpu:
model name : AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx

It works.

I'm attaching the fwts output just now...

The command sudo kprobe-perf 'p:dce_abm_set_backlight_level_pwm $arg1 $arg2 $arg3 $arg4 $arg5 '
Tracing kprobe dce_abm_set_backlight_level_pwm. Ctrl-C to end.
 mate-power-back-9415 [000] ...1 2421.242531: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x2117 arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9421 [003] ...1 2422.216410: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x2c19 arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9426 [004] ...1 2423.080217: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x371b arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9431 [005] ...1 2424.162837: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x421d arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9436 [002] ...1 2424.986163: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x371b arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9441 [004] ...1 2425.816147: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x2c19 arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9446 [000] ...1 2426.372179: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x2117 arg3=0x0 arg4=0x1 arg5=0x1
 mate-power-back-9451 [001] ...1 2426.897445: dce_abm_set_backlight_level_pwm: (dce_abm_set_backlight_level_pwm+0x0/0x440 [amdgpu]) arg1=0xffff8dbd577bfd00 arg2=0x1616 arg3=0x0 arg4=0x1 arg5=0x1

with arg5=0x1...

Revision history for this message
Ecker Sandor (esanya) wrote :

fwts output from Product Name : Aspire A315-41G with
cpu model name : AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx

Revision history for this message
Ecker Sandor (esanya) wrote :

lspci -vvn
from the a315-41G (where the brightness controll works)

Revision history for this message
Ecker Sandor (esanya) wrote :

lspci -vvnn
from Product Name : Aspire A315-41
model name : AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx

Where the brigthness controll does not work

Revision history for this message
Alex Hung (alexhung) wrote :

It seems that controller_id and use_smooth_brightness are from atombios (vbios?) and hardware itself; especially atombios (vbios?) are responsible for many VGA settings and it's a black box.

Good news is that kernel 5.7 will include some backlight enhancement (https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-OLED-Display-Backlight). We can give it a try later.

Revision history for this message
Alex Hung (alexhung) wrote :

Kernel 5.7rc1 is released, and it can be downloaded @ https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7-rc1/

There are some changes related to amd backlight from 5.6 to 5.7rc1 such as the following (list may be not completed), and it surely worthwhile to give 5.7rc1 a try.

accde06fcb7fd82abdfa77ecf4dc63d724a6d9bf
945628101be55833a63355510d4b6c934183deab
8a683eb6311a03b655ab8ff368cd7b203074275c
cb8348fec250e517b5facb4cab3125ddc597f9aa

Revision history for this message
Ecker Sandor (esanya) wrote :

Thank You for your support, I have tried the 5.7.rc1, but without success.

Then I have sent the laptop back to ACER, they have found a HW Failure...

Revision history for this message
Alex Hung (alexhung) wrote :

@esanya,

Thanks for updating the results. Hopefully the HW failure is the root cause of the brightness problem that acer can fix.

Revision history for this message
Marton Danko (golddragon007) wrote :

Hello,
I'm using Pop OS, and I have also the same issue like here it was described.
marton@pop-os:/sys/class/backlight/amdgpu_bl0$ cat actual_brightness
60944
marton@pop-os:/sys/class/backlight/amdgpu_bl0$ cat brightness
255
marton@pop-os:/sys/class/backlight/amdgpu_bl0$ cat max_brightness
255

I'm using Lenovo Legion 5 15ARH05 model. I've heard from multiple users has problems, that they can't modify their screen brightness.

From under windows it worked.

affects: linux → pop-os
Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :
Revision history for this message
Marton Danko (golddragon007) wrote :

Oh, is there a way to try out that patch? if yes how?

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

It's merged in v5.9-rc3, so please test latest mainline kernel:
https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.9-rc3/amd64/

Revision history for this message
Demyan Yarmoshik (niquepolice) wrote :

I have Lenovo 15ARH05 with Ryzen 7 4800h and the same problem as in bug description. In Fedora 32 with kernel 5.6.6-300 backlight control is fine, even though actual_brightness changes from 514 to 65536. But there is another bug in this kernel, so I updated to 5.8.4-200 and backlight control doesnt work here, actual_brightness just stuck at 311.
Checked v5.9-rc4, the only change I noticed is that brightness value restores after reboot if kernel parameter acpi_backlight=vendor is set (but the screen is at its full brightness anyway).

Revision history for this message
Tanapoom (timidpigeon) wrote :

I have Lenovo Legion 5 15ARH05 with Ryzen 5 4600H. I've checked that the issue is present in Ubuntu 20.10 beta, Fedora 32 with Kernel 5.8, Fedora 33, Manjaro with latest 5.8 kernel, opensuse tumbleweed.
On manjaro and fedora 32 with any kernel 5.6, and MX Linux backlight can be changed at first. But it seems force shutting down the laptop (hold power button) immediately breaks it and upon the next boot brightness cannot be changed. I've reproduced this behavior in manjaro, fedora 32, and MX Linux all with kernel 5.6.*.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.