Solved Can't adjust brightness AMD Ryzen with Vega graphics

Updated: solved thanks to the info at this message

I've been messing around with this laptop (Thinkpad E495) and FreeBSD since last year. While using the 13.0-CURRENT version until march, I was able to change the screen brightness via:

Code:
$ doas sysctl sys.class.backlight.amdgpu_bl0.bl_device.brightness=value

Now using the release version of FreeBSD 13 I can't change the brightness at all.
  • I have loaded the following modules
Code:
acpi_ibm_load="YES"
acpi_video_load="YES"
  • And I have the following relevant pkgs installed:
Code:
drm-fbsd13-kmod-5.4.92.g20210419 DRM modules for the linuxkpi-based KMS components
libdrm-2.4.106,1               Userspace interface to kernel Direct Rendering Module services
xf86-video-amdgpu-19.1.0_2     X.Org amdgpu display driver


I cannot reach sys.class.backlight.amdgpu_bl0.bl_device.brightness from sysctl anymore.

There is no result searching for backlight in sysctl.

All the info I can get from the screen, related to brightness is located at hw.acpi.video.lcd0:
Code:
$ sysctl -a | grep lcd
hw.acpi.video.lcd0.levels: 100 100 5 10 20 25 30 35 40 45 50 55 60 65 70 80 90 100
hw.acpi.video.lcd0.economy: 100
hw.acpi.video.lcd0.fullpower: 100
hw.acpi.video.lcd0.brightness: 100
hw.acpi.video.lcd0.active: 1

Trying to change the values manually doesn't affect actual screen brightness.

Code:
$ doas sysctl hw.acpi.video.lcd0.brightness=50

How should I proceed?
Thanks in advance.
 
Hi,
I have a Lenovo G50-45 laptop with brightness control keys F11 and F12 on the laptop keyboard. In order to make them work, I had to insert the line kld_list="acpi_video" in the file /etc/rc.conf.

SirDice has advised against loading the acpi_video driver in /boot/loader.conf. I have also installed drm-kmod and xf86-video.ati using pkg install.

The changes in screen brightness do not persist between reboots, but otherwise it works very well. Hope this helps.
 
insert the line kld_list="acpi_video" in the file /etc/rc.conf.
Hey Vull, I just tried adding the acpi_video line as you suggested but no luck. Still no backlight to access to from sysctl.

I also have the kld_list="/boot/modules/amdgpu.ko" line at /etc/rc.conf/

In my case I have doubts I need xf86-video-ati since the amd GPU is from 2019. But I'll double check just in case.
 
Hey Vull, I just tried adding the acpi_video line as you suggested but no luck. Still no backlight to access to from sysctl.

I also have the kld_list="/boot/modules/amdgpu.ko" line at /etc/rc.conf/

In my case I have doubts I need xf86-video-ati since the amd GPU is from 2019. But I'll double check just in case.
You will need to reboot, which you probably already know, or you can just run kldload acpi_video to test it without rebooting first.

Maybe acpi_ibm is interfering? Just guessing -- I really have no idea, but it might be worth a try to unload it temporarily and re-test the backlighting features. kldunload acpi_ibm

If xf86-video-amdgpu is already working, you probably don't need xf86-video-ati. It might even be contraindicated.

Just for your information, I am presently using 13.0-RELEASE-p3, but it was already working with 13.0-RELEASE before upgrading.

I didn't install drm-fbsd13-kmod-5.4.92.g20210419 directly, but rather, I installed drm-kmod, which includes it as a dependency.
 
Hey, just as a reminder: You're supposed to run sysctl as root user. Stuff like doas is not recommended on FreeBSD. A root user's shell prompt is the pound sign (#). Also, I'd suggest checking whether amdgpu.ko is actually loaded. For that, you'd use # kldstat.
 
Thank you for all the answers :)

Yes, I'm aware of the need to reboot for this kind of tweaking, as well as of loading/unloading kernel modules on the fly.
I tried both ways to check if something changes but still, no luck.
If I disable acpi_ibm I just loose battery info, but brightness still unreachable.

I tried running sysctl as root as astyle recommends but no new settings appear.

# sysctl -a | grep backlight returns nothing.

As I mentioned in the first message, I tried with the lcd0.brightness setting (as it works on another Thinkpad I have, but that's an intel HD graphics one). Running the command as root does the same answer, but brightness at screen stays full bright.
Code:
# sysctl hw.acpi.video.lcd0.brightness=20
hw.acpi.video.lcd0.brightness: 100 -> 20

Lastly, kldstat returns amdgpu.ko as loaded, as well as some amd_gpu_picasso*.ko ones.

Code:
# kldstat
Id Refs Address                Size Name
 1  103 0xffffffff80200000  1f11ef8 kernel
 2    1 0xffffffff82112000     ae38 cryptodev.ko
 3    1 0xffffffff8211d000    2e6e0 if_iwm.ko
 4    1 0xffffffff8214c000     6fd0 amdtemp.ko
 5    2 0xffffffff82153000     3e48 amdsmn.ko
 6    1 0xffffffff82157000   67feb0 zfs.ko
 8    1 0xffffffff827ee000     91d8 acpi_ibm.ko
 9    1 0xffffffff827f8000   290c00 iwm9260fw.ko
10    1 0xffffffff82a89000     a348 acpi_video.ko
11    1 0xffffffff82a94000    2a120 fusefs.ko
12    1 0xffffffff82e00000   31fd70 amdgpu.ko
13    2 0xffffffff82d18000    7f4c8 drm.ko
14    3 0xffffffff82d98000     cbc8 linuxkpi_gplv2.ko
15    1 0xffffffff82da5000     2328 lindebugfs.ko
16    1 0xffffffff82da8000     e778 ttm.ko
17    1 0xffffffff82db7000     2218 amdgpu_picasso_gpu_info_bin.ko
18    1 0xffffffff82dba000     64d8 amdgpu_picasso_sdma_bin.ko
19    1 0xffffffff82dc1000    2e2d8 amdgpu_picasso_asd_bin.ko
20    1 0xffffffff82df0000     7558 amdgpu_picasso_pfp_bin.ko
21    1 0xffffffff82df8000     6558 amdgpu_picasso_me_bin.ko
22    1 0xffffffff83120000     4558 amdgpu_picasso_ce_bin.ko
23    1 0xffffffff83125000     b9c0 amdgpu_picasso_rlc_bin.ko
24    1 0xffffffff83131000    437e8 amdgpu_picasso_mec_bin.ko
25    1 0xffffffff83175000    437e8 amdgpu_picasso_mec2_bin.ko
26    1 0xffffffff831b9000     7bb8 amdgpu_raven_dmcu_bin.ko
27    1 0xffffffff831c1000    5ab38 amdgpu_picasso_vcn_bin.ko
28    1 0xffffffff8321c000     3378 acpi_wmi.ko
29    1 0xffffffff83220000     3218 intpm.ko
30    1 0xffffffff83224000     2180 smbus.ko
31    1 0xffffffff83227000     2240 pflog.ko
32    1 0xffffffff8322a000    36f70 pf.ko

Maybe is something related to AMD APUs like this Ryzen + Vega graphics that has changed on the drm, but I have no clue.
What I feel curious about is where did sys.class.backlight.amdgpu_bl0.bl_device.brightness go?
And why if kernel modules are loaded, no backlight is detected for the monitor.

Here's a dmesg log and a Xorg log just in case.
 
Geezer I can use xrandr yes, and it reports correct values for monitor layouts and display size, but the xbacklight utility isn't working.

I've looked after the /dev/backlight directory as T-Daemon suggests and I have the following inside:
Code:
amdgpu_bl00
backlight0

After reading backlight(8) I can now adjust the brightness with the command
Code:
$ backlight -f amdgpu_bl00 b_value

Thank you all so much for your time and suggestions :)
 
Can you use xrandr --output [whatever] --brightness [0 to 1.0 (or even more)] ?

Using xrandr --listmonitors to get the whatever for output.
 
Geezer It's possible to change brightness via xrandr(1) as you mention yes. But isn't changing brightness’ value via xrandr(1) actually changing the gamma instead of physical brightness? That wouldn't be so much power efficient.
 
No f0r3ign3r . You can use the args --brightness and --gamma together, or not. By adding to one and subtracting from the other, you can get fine control over contrast too.

If the screen is less bright, less power is being used. I think.
 
Oh, I must have missed something when I tried. Then that way could be a solution to the brightness setting if /dev/backlight/ happens to be empty.
 
Back
Top