Script to sync AMDGPU performance level with power-profiles-daemon (needs to be ran as root):
#!/usr/bin/python3
import sys
from gi.repository import Gio, GLib, GObject
amdgpu = None
proxy = None
loop = None
def on_changed_props(proxy, changed_props, invalidated_props):
amdgpu = open("/sys/class/drm/card0/device/power_dpm_force_performance_level", "w")
profile = changed_props['ActiveProfile']
print(profile)
amdgpu_profile = "auto"
if profile == "performance":
amdgpu_profile = "high"
elif profile == "power-saver":
amdgpu_profile = "low"
amdgpu.write(amdgpu_profile)
amdgpu.close()
try:
loop = GLib.MainLoop()
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
'net.hadess.PowerProfiles',
'/net/hadess/PowerProfiles',
'net.hadess.PowerProfiles', None)
proxy.connect('g-properties-changed', on_changed_props)
loop.run()
except KeyboardInterrupt:
if amdgpu is not None:
amdgpu.close()
if loop is not None:
loop.quit()
I know about gamemode but that wasn't working for me for some reason:
https://github.com/FeralInteractive/gamemode/issues/351