amdgpu, dc, backlight brightness

Andriy Gapon avg at FreeBSD.org
Wed Apr 29 07:29:10 UTC 2020


I see that amdgpu_atif_handler() has this comment and code:
                /* todo: add DC handling */
                if ((req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) &&
                    !amdgpu_device_has_dc_support(adev)) {
...
                }

So, this makes me curious how a typical Linux distribution handles backlight
brightness change via special keys hooked to ACPI.

This is what I see on FreeBSD.
- a special key is pressed
- there is a bunch of uninteresting ACPI and kernel stuff involving EC
- ACPI notification 0x86 on VGA.LCD device is handled by acpi_video driver
- the driver invokes VGA.LCD._BCM method
- if I read the ASL of my system correctly, ACPI does not touch any hardware
  but simply saves some things like the requested brightness level
- then ACPI posts notification 0x81 on VGA device
- the notification gets routed to amdgpu
- amdgpu invokes VGA.ATIF and gets some interesting data from ACPI
- and this is where things stop in the DC case (because of the code above)

In the non-DC case amdgpu would actually set the brightness based on the data
returned from ATIF.  radeon driver also did the same as far as I can see.

So, how things work in the DC case?

I see that Linux acpi_video does something that FreeBSD doesn't do, it posts
KEY_BRIGHTNESSUP / KEY_BRIGHTNESSDOWN / etc.  I guess that in the end this is
similar to just having the corresponding multimedia keys on a keyboard.
Is this how the brightness control supposed to work?
So, there must be some userland program listening for those keys and somehow
knowing about amdgpu backlight controls (e.g., /sys/class/backlight/amdgpu_bl0).
Is that correct?

I tried a live image of Void Linux (LXQT flavor).  While it does handle the
special brightness keys it seems to do it without actually controlling the
backlight.  That is, it makes the picture lighter / darker, but values under
/sys/class/backlight/amdgpu_bl0 do not change.  If I set brightness under
/sys/class/backlight/amdgpu_bl0 to some low level then the brightness up key
cannot make the screen brighter.  So, it appears to be just a rendering /
composition trick.

Thank you.
-- 
Andriy Gapon


More information about the amd-gfx mailing list