Using Autostart to run a script to alter the parameter "power dpm force performance level" has issues

Hello everyone,

I’ve been working on resolving a flickering issue I’ve experience with KDE at high refresh rates. After much trial and error as well as getting answers on different websites, I have found the settings that need to be changed to get rid of the flickering. Namely, I need to set the parameters power_dpm_force_performance_level and/or pp_dpm_mclk to be constant values, both of which can be found here…


power_dpm_force_performance_level is set at “auto” by default and pp_dpm_mclk has four options that can change.

As for how to manually do this, here are two examples of command line prompts that will do just that (assuming logged in as root)…

Example 1:

echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level


Example 2:

echo manual > /sys/class/drm/card0/device/power_dpm_force_performance_level
echo 3 > /sys/class/drm/card0/device/pp_dpm_mclk

However, applying the commands in Example 1 or 2 are just temporary fixes. After restarting the computer, power_dpm_force_performance_level is set back to "auto” and pp_dpm_mclk changes as well.

Thus, I want to make a script or something similar that will run the Example 1 code on startup. So I made a simple file called, put a single line of code in it, being…

echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level

and then in KDE’s Autostart application, I click + Add…, + Add Login Script…, and then select the script that I just made.

However, I can confirm this does not work, with power_dpm_force_performance_level set to "auto” on startup. I’m not that familiar with writing scripts, so I might be missing something there. Can someone assist? If there is no issue there, it might be an issue with KDE’s Autostart, but I’m not sure.

You need root access to write to /sys. Autostarts run in your user account, so they don’t have write permission.
You can create a script /etc/profile.d/ with content:

echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level

So it runs on boot, as the root user.

I believe I have done what you suggested with a script /etc/profile.d/ with the only line being.

echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level

This can be seen in the below image.

However, upon restarting the computer, the setting for power_dpm_force_performance_level is still auto.

Thus, is just having in /etc/profile.d/ supposed to cause it to run when booting or is something else needed to actually get linux to run the script? I tried making the file executable, adding sudo before the echo command, and adding this script to AutoStart (you made it sound like it wouldn’t work, but just spitballing), but the result hasn’t changed.

Not sure if it matters or not, but maybe the issue has to deal with what is listed as output in the image. Something about server binary: bash-language-server?

Sorry. My bad. You don’t need to make it executable, as it’s sourced by /etc/profile upon login. The problem is that /etc/profile is not sourced in root, but in your user account. So it won’t work. Sorry for that.

If there’s /etc/rc.local or /etc/rc.d/rc.local in your system, you can put the command there.

Otherwise, you need a systemd service. Create a file /etc/systemd/system/power-dpm.service:

Description=set the parameters power_dpm_force_performance_level 

ExecStart=/bin/bash -c 'echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level'


Then run:

sudo systemctl daemon-reload
sudo systemctl enable power-dpm.service

It should run in next boot. You can check if it runs correctly with systemctl status power-dpm.service

1 Like

I can confirm this works. Thank you so much. It’s been quite the search to find a solution to this issue.