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!

33 thoughts on “Ubuntu open source ATI radeon driver power usage tweaks

  1. Keivan

    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.

    Reply
  2. Marko Author

    @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

    Reply
  3. Keivan

    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

    Reply
  4. Marko Author

    @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!

    Reply
  5. 0x3e9

    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

    Reply
  6. gempaouindo

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

    Reply
  7. gempaouindo

    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
    :/

    Reply
  8. gempaouindo

    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!

    Reply
  9. Joel

    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.

    Reply
  10. gempaouindo

    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 ;)

    Reply
  11. Denis

    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

    Reply
  12. tk421

    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.

    Reply
  13. tosho

    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 ??

    Reply
  14. tosho

    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

    Reply
  15. tosho

    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.

    Reply
    1. Marko Author

      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
      Reply
    1. Marko Author

      Hello,
      something like:

      # Remove script
      sudo rm /etc/init.d/ati-power-save
       
      # Remove startup links
      sudo update-rc.d ati-power-save remove
      Reply
  16. the_Squarez

    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?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *