Home » Linux » Ubuntu open source ATI radeon driver power usage tweaks

Ubuntu open source ATI radeon driver power usage tweaks

I've always had Nvidia GPU card in my PCs. The only reason for that is great Linux support. Recently I've bought laptop with ATI HD4200 integrated GPU so I had to learn "how to walk on Linux" all over again. First thing there are two opensource drivers and fglrx proprietary ATI driver. Quantity is not quality so any of those drivers is not up to pair with current Nvidia drivers.

Open source driver lacks good 3D acceleration and quality power save functionality (it is laptop we're talking about) and fglrx driver has poor 2D acceleration. Basically it is up to you to decide which driver to use based on the way you use your PC. I've picked open source driver in spite the fact that it has no power save capabilities. Actually it has some basic power save capabilities, but they are turned off by default. In this article I will show you how to keep you ATI graphics card power usage under control on the Ubuntu Maverick based Linux operating systems with open source ATI radeon driver (could work for Debian and derivatives with kernel >=2.6.35).

First thing we must create script that will apply our settings on every reboot. We create script called "ati-power-save" and then we will fill it with our power save commands I will explain later:

sudo gedit /etc/init.d/ati-power-save

Now that you have text editor in front of you you must choose between two power save methods. First method is called "dynpm" and the second method is called "profile" method.

Dynpm method

Dynpm method is more modern and efficient but it might not work with some hardware combinations (like mine for example). This method will adjust your GPU frequency and voltage based on the current demand. Here is what you need to put inside /etc/init.d/ati-power-save to use dynpm power save method.

#!/bin/sh
 
# ATI power save
echo dynpm > /sys/class/drm/card0/device/power_method

Profile method

Power profile method is based on four power profiles you choose manually or at boot time using script like the one we are creating here. You can choose between 1. "default" 2. "auto" 3. "low" 4. "high". Here is what you need to put inside /etc/init.d/ati-power-save to use profile power save method.

#!/bin/sh
 
# ATI power save
echo profile > /sys/class/drm/card0/device/power_method
echo low > /sys/class/drm/card0/device/power_profile

Instead of "low" profile you can select any of four supported power profiles. Now save your settings and close your text editor. To check current status of ATI power save (current method dynpm or profile and current power profile in case of profile method) and current ATI core and memory frequencies you can use following commands in your terminal:

cat /sys/class/drm/card0/device/power_method
cat /sys/class/drm/card0/device/power_profile
cat /sys/kernel/debug/dri/0/radeon_pm_info

All that's left is to mark our script executable (thanks Kevian for pointing this out) and to put it to be run at boot:

sudo chmod +x /etc/init.d/ati-power-save 
sudo update-rc.d ati-power-save defaults 99

That is it. Now reboot you PC and use "cat" commands to check are you settings applied. Cheers!

Categories: Linux
Tags:
Comments
  • the_Squarez December 25, 2012 at 22:59:50

    uh my laptop is hd 5470 1gb edition core i 7 but i downclock it with amd clock tools 80 mhz 100 mhz well max 750 mhz 750 mhz sometimes i set to
    800mhz 900mhz but when i put to 80 mhz 100 mhz it only last 1hours
    mybee fan or cpu or something.. can u help me?

  • kepike July 29, 2012 at 21:05:57

    Hello, how do I revert this? Is sudo rm /etc/init.d/ati-power-save enough?

    • Marko July 29, 2012 at 22:10:00

      Hello,
      something like:

      # Remove script
      sudo rm /etc/init.d/ati-power-save
       
      # Remove startup links
      sudo update-rc.d ati-power-save remove
  • Todd Partridge (Gen2ly) July 29, 2012 at 11:14:28

    Great post, thank you. For some reason putting the command in the rc.local file doesn’t work and, hence, the init script is necessary. Very well written post, thank you.

  • Ivan July 24, 2012 at 19:51:34

    Is it possible to manually change clock and voltage?

    • Marko July 24, 2012 at 21:47:49

      Sure. Just use sudo -i to go to root terminal and issue commands for example:

      sudo -i
      echo dynpm > /sys/class/drm/card0/device/power_method
  • tosho June 22, 2012 at 14:30:42

    Hi there,
    I did the tutorial the right way – ati-power-save is loaded at boot but still the power_profile is set to high when I check it in terminal with cat , so I have to set again to low manually after login.

  • tosho June 21, 2012 at 09:35:24

    my bad I missed : defaults 99
    I had this now:

    tosho@Zion:~$ sudo update-rc.d ati-power-save defaults 99
    update-rc.d: warning: /etc/init.d/ati-power-save missing LSB information
    update-rc.d: see
    Adding system startup for /etc/init.d/ati-power-save …
    /etc/rc0.d/K99ati-power-save -> ../init.d/ati-power-save
    /etc/rc1.d/K99ati-power-save -> ../init.d/ati-power-save
    /etc/rc6.d/K99ati-power-save -> ../init.d/ati-power-save
    /etc/rc2.d/S99ati-power-save -> ../init.d/ati-power-save
    /etc/rc3.d/S99ati-power-save -> ../init.d/ati-power-save
    /etc/rc4.d/S99ati-power-save -> ../init.d/ati-power-save
    /etc/rc5.d/S99ati-power-save -> ../init.d/ati-power-save

  • tosho June 21, 2012 at 09:32:53

    tosho@Zion:~$ sudo update-rc.d /etc/init.d/ati-power-save
    usage: update-rc.d [-n] [-f] remove
    update-rc.d [-n] defaults [NN | SS KK]
    update-rc.d [-n] start|stop NN runlvl [runlvl] [...] .
    update-rc.d [-n] disable|enable [S|2|3|4|5]
    -n: not really
    -f: force

    The disable|enable API is not stable and might change in the future.

    is this message a problem ??

  • tk421 April 10, 2012 at 12:22:18

    Thank you so much for this! It works very well indeed and has greatly reduced the fan noise coming from the GPU. The fan is still not as quiet as in Windows but I guess the open source drivers can only improve even further as time goes on. I didn’t want to use the closed source ones. Thanks again.

  • George Labuschagne March 20, 2012 at 22:46:00

    Thanks! Used it on Kubuntu 11.10 and it works perfect :)

  • Denis November 20, 2011 at 16:22:19

    Great, it works for Lubuntu 11.10, HP nw8440 laptop with ATI Mobility FireGL V5200 .

    My ears will rest now, cause fan is not so laud any more :D

    Thank You very much !
    Denis

  • gempaouindo August 29, 2011 at 12:27:58

    I have just posted a translation in french on the linuxmint-fr forum with a link to your site. If it bother you please tell me ;)

    • Marko August 29, 2011 at 12:51:35

      No problem, I’m glad you’ve found it useful ;)

  • Marko July 28, 2011 at 09:24:31

    @Joel

    Thanks for your words, I hate Fglrx as much as you do maybe even little more ;)

  • Joel July 28, 2011 at 02:18:04

    You deserve a medal. This guide fixed my exact problem. You have a solution that no one else could offer.

    I’m attempting to learn Linux and it has been a trial to say the least, but having my GPU fan howl at me made my life even more miserable. One of my greatest triumphs was discovering that the fan was indeed my graphics card and not one of my CPUs. How to solve it was another story entirely.

    Thanks to you I can kiss FGLRX goodbye. My power bill will thank you too.

  • gempaouindo July 13, 2011 at 19:43:41

    I missed this keivan part in the begining of the script ; now it’s working like a charm.
    ### BEGIN INIT INFO
    # Provides: scriptname
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start daemon at boot time
    # Description: Enable service provided by daemon.

    ### END INIT INFO

    Bye Evil FGLRX. Thanks you for all of this, I learn few things about init.d scripts and init services!

  • gempaouindo July 13, 2011 at 18:26:05

    I’m in debian so don’t use “sudo” but “su” before all this command lines.

  • gempaouindo July 13, 2011 at 18:24:09

    update-rc.d ati-power-save defaults 99
    Give me as result :
    update-rc.d: using dependency based boot sequencing
    insserv: warning: script ‘K01ati-power-save’ missing LSB tags and overrides
    insserv: warning: script ‘ati-power-save’ missing LSB tags and overrides
    :/

  • gempaouindo July 13, 2011 at 18:07:24

    Hi, yes it’s working when entered manually!
    Trying making executable the script! That makes senses.

  • Marko July 13, 2011 at 14:24:37

    @Keivan

    True, LSB Init script must be marked as executable to be run at boot. Thanks for pointing this out.

  • Keivan July 13, 2011 at 13:57:17

    chmod +x /etc/init.d/ati-power-save

  • Keivan July 13, 2011 at 13:43:21

    sudo update-rc.d ati-power-save defaults 99

    I’ve tried the provided command but there was no luck

  • Marko July 11, 2011 at 22:42:10

    @gempaouindo

    Hi! Does it work when entered manually?

  • gempaouindo July 11, 2011 at 22:30:36

    I don’t understand : it was working but not anymore! the same LSB message as Keivan!

  • Marko July 5, 2011 at 09:59:33

    @gempaouindo

    Great it works! True, fglrx is like Dr. Evil ;)

  • gempaouindo July 5, 2011 at 09:49:09

    Thank you so much! bye fglrx and tearing video hello gnome 3 without strange artifacts!

  • Marko July 2, 2011 at 18:35:15

    @0x3e9

    Great it works and thanks for pointing out crossfire scenario, if you don’t mind I will add it to the article?

    Cheers!

  • 0x3e9 July 2, 2011 at 15:41:44

    Thanks! Works great!
    Note that if you have multiple GPUs (ATI Crossfire) you need to apply the settings for each GPU:

    Dynpm Method:

    echo dynpm > /sys/class/drm/card0/device/power_method
    echo dynpm > /sys/class/drm/card1/device/power_method

    Profile Method:

    echo profile > /sys/class/drm/card0/device/power_method
    echo low > /sys/class/drm/card0/device/power_profile
    echo profile > /sys/class/drm/card1/device/power_method
    echo low > /sys/class/drm/card1/device/power_profile

  • Marko June 30, 2011 at 01:23:03

    @Keivan

    Hi Keivan. I assume that all works when entered manually? It is really hard for the script not to work. If there are symlinks at /etc/rcX.d for the ati-power-save bash script (update-rc.d makes them) and if those links lead to the /etc/init.d/ati-power-save with commands that work correct when entered manually things must work. The only thing that could happen is that boot process overrides these settings later in the boot process and then you should enqueue our ati-power-save script later in the boot process but 80 should be enough. To do this you can use sudo update-rc.d ati-power-save defaults 99. Cheers!

  • Keivan June 30, 2011 at 00:42:14

    Autostart script do not work. This is the proof:

    mount -t debugfs none /sys/kernel/debug
    keivan-laptop keivan # cat /sys/class/drm/card0/device/power_method
    profile
    keivan-laptop keivan # cat /sys/class/drm/card0/device/power_profile
    default
    keivan-laptop keivan # cat /sys/kernel/debug/dri/0/radeon_pm_info
    default engine clock: 432000 kHz
    current engine clock: 432000 kHz
    default memory clock: 396000 kHz
    current memory clock: 396000 kHz
    PCIE lanes: 0

  • Marko June 28, 2011 at 10:58:54

    @Keivan

    Hi! Debian init services should have following header:

    ### BEGIN INIT INFO
    # Provides: scriptname
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start daemon at boot time
    # Description: Enable service provided by daemon.
    ### END INIT INFO

    This header is good practice for some kind of system service but not necessary for little script operation. “Missing LSB information” warning is telling just that the info part isn’t there. More on Debian LSBInitScripts:

    http://wiki.debian.org/LSBInitScripts

  • Keivan June 28, 2011 at 08:13:37

    What is this warning: “missing LSB information”

    update-rc.d ati-power-save defaults 80
    update-rc.d: warning: /etc/init.d/ati-power-save missing LSB information
    update-rc.d: see
    System start/stop links for /etc/init.d/ati-power-save already exist.