amdgpu, dc, backlight brightness
Alex Deucher
alexdeucher at gmail.com
Wed Apr 29 18:15:23 UTC 2020
On Wed, Apr 29, 2020 at 3:29 AM Andriy Gapon <avg at freebsd.org> wrote:
>
>
> 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.
I think it varies from OEM to OEM and whatever windows required at the
time. The sbios may also do different things depending on the osi
string passed to ACPI. Originally, ACPI handled it all directly.
Then we got some laptops which which did the whole event via ATIF
thing (even that I think varied based on the . Later, I think the
keys just produced brightness events and it was up to the OS to do
something with them so the user's environment would catch the events
and adjust the backlight via the standard OS backlight control
interface. We never hooked up the ATIF stuff to DC since I don't
recall ever running into any laptops that used it for backlight
control (the code was carried over from radeon when we forked amdgpu).
Alex
More information about the amd-gfx
mailing list