[RESPONDED] Amdgpu kernel module setting backlight brightness to max brightness whenever it's loaded

Hello,

This is super annoying as I mostly use the laptop at night, but it seems that the amdgpu kernel module, as soon as it’s loaded (or during KMS) will set the brightness of the backlight to some default value, thus blinding me at night as soon as it’s loaded.

I don’t recall the intel GPU doing something like this, it’d just leave the brightness alone – is this a bug? Or where else do I take this, the linux kernel mailing list?

Unclear as to which distro you are on, however it’s worth filing a bug report with your reproduction steps and logs.

Ah you mean with my distro, right? Good idea, I’ll try that, and also try to reproduce it on Fedora.

I’m guessing this isn’t the intended behaviour though? I’m just trying to figure out if this is intended, and another mechanism (like systemd-backlight) is supposed to restore the backlight as soon as it happens.

This kernel commit message mentions setting max brightness at boot:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=53a53f8687faf492df2644d8c18ff0217fc18730

I traced the actual codepath for init, though (it’s mostly in amdgpu_dm.c), and it looks like like when it sets up the backlight device in the display manager object, it sets the value to some default value for all connected eDP displays, which was introduced in this commit:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3d6c91641bc8a883b0c810ac1a919db29ebd5ee7

So it vaguely sounds like this is intended, and it relies on userspace brightness controls to just override this. In case anyone else can benefit from this little bit of research.

It’s strange that Intel does not do this though.

I don’t remember what Intel does by default but I’ve been orderriding it in user space using custom code that looks generic enough that it might work for you with AMD as well:

$ cat /etc/udev/rules.d/99-backlight.rules
ACTION=="add", SUBSYSTEM=="backlight", RUN="/etc/udev/backlight.sh"
$ cat /etc/udev/backlight.sh 
#!/bin/sh

#LCD=/sys/class/drm/card0-eDP-1
#BACKLIGHT=$LCD/intel_backlight

# Preferred setting is 24000, 25% brightness; gives ~100lux with
# calibration
echo 24000 >/sys$DEVPATH/brightness