Adaptive Backlight Management (ABM)

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…

Not expected at all.

There isn’t a v2 posted yet but the solution is basically going to be for the driver to do an internal modeset when the sysfs file is written to.

It won’t do a lot of good until v2 is posted; but I’ve also wired up a MR for PPD to toggle ABM dynamically:

Add support for a panel power savings action (!137) · Merge requests · upower / power-profiles-daemon · GitLab

Basically if on battery it will set:

  • ABM 3 for “power saver”
  • ABM 1 for “balanced”
  • ABM 0 for “performance”.

If on AC it will set ABM 0.

1 Like

Thank you! Gave it another try and now the brightness keys are working.

Here’s v2 which does the modeset I mentioned.

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

4 Likes

Works like a charm :smiley:.

Thank you!

2 Likes

I applied your patch and it works to change the ABM level.

But sometimes I get flickering after I change the value.
When changing the value again it disappears.


~1sec I see this, then ~1sec the normal screen and this repeats until I change the value again.
I also have a video of it, but cannot upload it here