Adaptive Backlight Management (ABM)

Yeah it’s not the same thing, I wouldn’t expect this to influence lowest possible brightness.

1 Like

Does amdgpu’s adaptive backlight management offer any significant advantage over something like wluma, that just sets the screen brightness through an algorithm using the backlight sensor and screen content?
wluma uses the export-dmabuf wayland protocol and Vulkan on the GPU to run the algorithm, which is extremely resource-efficient.

I’m not aware of any analysis of it, but they are of course different algorithms that run differently.

The abm method is hardware based and will work with X, Wayland or a console.

It sounds like what you shared attempts to be resource light, but I think someone would need to run some benchmarking with each and the same workloads to confirm power consumption impact for each of them.

1 Like

Makes sense. Once I receive my Framework 16 I’ll probably do some comparison tests and post them here

Does anyone know what API the kernel exposes for userspace to switch the ABM level? It’s mentioned in the docs, but there’s no link or followup. I’m considering coding a quick CLI tool for it.

It uses the DRM API. But you can only change it using the DRM master (the compositor).
So you would need to write a change for your compositor.

For example in GNOME this is mutter.

When you say runtime, do you mean in a running system? I’m having trouble working out how to do this. How can I do that? sysctl amdgpu.abmlevel=0 doesn’t work, and I’m not sure sure what other ways there are.

As I mentioned in the previous reply changing it at runtime needs to be done by the DRM master, which is the compositor.

You can change it on the kernel command line or a module parameter to amdgpu to be effective for the whole boot.

2 Likes

Good news folks!

[PATCH] drm/amd/display: add panel_power_savings sysfs entry to eDP connectors (kernel.org)

9 Likes

Thank you @Mario_Limonciello,
i’ve applied the Patch on 6.7.2. The sysfs device is present:

ls -l /sys/module/amdgpu/parameters/ | grep abm                
-r--r--r-- 1 root root 4096 27. Jan 09:15 abmlevel

The problem is, that it`s not writable on runtime. It´s not possible to set a value.
What have i done wrong? Can someone help me understanding how that is suppose to work?
Thanks!

UPDATE: Got it… In my case the device is:

/sys/devices/pci0000:00/0000:00:08.1/0000:c1:00.0/drm/card1/card1-eDP-1/amdgpu/panel_power_savings

Applying the abmlevels here works perfect! The only unusual find is, that applying 0 (abm off) leads to an abmlevel of 255? Is this normal?

1 Like

The path is different now. It should be something like this:

/sys/class/drm/card1-eDP1/panel-power-savings

If you don’t have simple DRM enabled in your kernel config that will be card0

2 Likes

@Mario_Limonciello:

After a few tests i can say that at least in my system it’s not working. Setting a value between 0 and 4 in /sys/.../panel_power_savings changes nothing in the panel behavior.

Setting an abmlevel via kernel option still works as intended.

Should setting a value in /sys/.../panel_power_savings appear in /sys/module/amdgpu/parameters/abmlevel?

What am I missing?

Update: Further investigation shows that setting an abmlevel via kernel option appears in /sys/…/panel_power_savings. The other way around it is not working unfortunately.

1 Like

The module option will not update when you change at runtime since it’s read only and reflects the value set on kernel command line.

If it’s not working functionally from the runtime something might be wrong with the code.

Can you please bring feedback to the patch?

Thanks!

Sure, I tried several ways to reply to the Patch but poorly i always get a deny from the mailing list. I’ve no more time left for now…
Maybe someone else is clever enough :sweat_smile:.

This is the feedback i’ve tried to put on the mailing list:

I’ve applied the patch to 6.7.2. The device then shows up under:

/sys/devices/pci0000:00/0000:00:08.1/0000:c1:00.0/drm/card1/card1-eDP-1/amdgpu/panel_power_savings
(on Framework Laptop 13 amd 7840U with 780M).

After a few tests i can say that at least in my system it’s not working. Setting a value between 0 and 4 in /sys/…/panel_power_savings changes nothing in the panel behavior. There are no errors in kernel log.

Setting an abmlevel via kernel option still works as intended.

An other investigation is, that when setting abmlevel=0 via kernel option the value shown in /sys/…/panel_power_savings is 255 instead of 0. For abmlevel values 1 to 4 set via kernel option the values shown in /sys/…/panel_power_savings are the same.

I did some Google-Fu but I could not figure out which hardware this ABM feature corresponds to. Trying to get it working on an older Zen+ mobile CPU/APU. Anyone hapen to know? I.e. amd-pstate is only working on Zen 2 and newer CPU…

Sure, I tried several ways to reply to the Patch but poorly i always get a deny from the mailing list. I’ve no more time left for now…

Make sure you’re not doing HTML mail. Mailing lists hate that. What you should ideally do is hit the reply button on the lore link and it will give you a file that you can open in Thunderbird and do “reply all”. This should do it all “right”.

An other investigation is, that when setting abmlevel=0 via kernel option the value shown in /sys/…/panel_power_savings is 255 instead of 0. For abmlevel values 1 to 4 set via kernel option the values shown in /sys/…/panel_power_savings are the same.

I have a theory on it. Can you please try to do a resolution change to something lower and back to normal after adjusting? If that works, they’re missing a notification to the hardware on the property change.

I did some Google-Fu but I could not figure out which hardware this ABM feature corresponds to. Trying to get it working on an older Zen+ mobile CPU/APU. Anyone hapen to know? I.e. amd-pstate is only working on Zen 2 and newer CPU…

The easiest way to check if your hardware supports it is to run drm_info | grep abm. In hardware that supports it you’ll see output like this:

$ drm_info | grep abm
│   │       ├───"abm level": range [0, 4] = 3

That’s exactly what i did… :thinking:!?

Your theory is approved! Changing resolution after setting the panel_power_savings value did the trick.

Would you mind informing the developers?

Thank you very much spending your time on this!

There is an option somewhere in Thunderbird to send as plain text or html. I guess the default must be html.

Ah great! If I don’t see your reply on Monday I’ll mention this. Thanks for testing it.

Sure! I’m also planning to wire it up to PPD, so these testing results are really helpful to catch the problem now.

4 Likes

after setting amdgpu.abmlevel=4 I cannot manually change display brightness with the function keys.
Is this expected?

I can not confirm this. It`s working here…