# Interesting discovery with ATI's new PowerPlay for linux...

## TerranAce007

I have a laptop with a Mobility Radeon 9700 (M11) which I dual boot gentoo and XP home on. Powerplay under windows works great, but I never really use it because all I have XP for is for gaming, and I am always plugged in for games. Powerplay makes it impossible to play gpu-intensive games anyway... Under gentoo, on the other hand, I don't have any real need for 3D acceleration or a fast graphics card because I use gentoo for everything else, so powerplay is much more important. I had found a program (rovclock) in this forum to overclock ATI cards, but I actually use it to underclock mine for my own 'powerplay' setup. When I saw that ATI had released drivers with powerplay support, I went and upgraded to ati-drivers-8.20.8 on ~amd64.

I did some testing and it seems that powerplay doesn't actually set the clock speeds on my card correctly:

```

mobile rovclock-0.6c # aticonfig --lsp

  core/mem      [flags]

---------------

1: 105/105 MHz  [low voltage]

2: 446/216 MHz  [default state]

mobile rovclock-0.6c # aticonfig --set-powerstate=2

Using /etc/X11/xorg.conf

Warning: Option 'PowerState' won't affect future sessions.

```

Clock settings from rovclock, which match the above and what I get in Windows:

```

mobile rovclock-0.6c # ./rovclock -i

Radeon overclock 0.6b by Hasw (hasw@hasw.net)

Found ATI card on 01:00, device id: 0x4e50

I/O base address: 0xc800

Video BIOS shadow found @ 0xc0000

Reference clock from BIOS: 27.0 MHz

Memory size: 131072 kB

Memory channels: 1, CD,CH only: 0

tRcdRD:   4

tRcdWR:   2

tRP:      4

tRAS:     9

tRRD:     3

tR2W-CL:  3

tWR:      3

tW2R:     2

tW2Rsb:   1

tR2R:     2

tRFC:     17

tWL(0.5): 2

tCAS:     3

tCMD:     0

tSTR:     1

XTAL: 27.0 MHz, RefDiv: 9

Core: 445.50 MHz, Mem: 216.0 MHz

```

Glxgears at default clock settings:

```

mobile rovclock-0.6c # glxgears

12737 frames in 5.0 seconds = 2547.400 FPS

15484 frames in 5.0 seconds = 3096.800 FPS

15559 frames in 5.0 seconds = 3111.800 FPS

15483 frames in 5.0 seconds = 3096.600 FPS

```

Now, I set the card to low voltage mode and aticonfig returns success, but the clock speeds are wrong, which won't save much power. Glxgears scores show this too....

```

mobile rovclock-0.6c # aticonfig --set-powerstate=1

Using /etc/X11/xorg.conf

Warning: Option 'PowerState' won't affect future sessions.

mobile rovclock-0.6c # ./rovclock -i

Radeon overclock 0.6b by Hasw (hasw@hasw.net)

Found ATI card on 01:00, device id: 0x4e50

I/O base address: 0xc800

Video BIOS shadow found @ 0xc0000

Reference clock from BIOS: 27.0 MHz

Memory size: 131072 kB

Memory channels: 1, CD,CH only: 0

tRcdRD:   4

tRcdWR:   2

tRP:      4

tRAS:     9

tRRD:     3

tR2W-CL:  3

tWR:      3

tW2R:     2

tW2Rsb:   1

tR2R:     2

tRFC:     17

tWL(0.5): 2

tCAS:     3

tCMD:     0

tSTR:     1

XTAL: 27.0 MHz, RefDiv: 9

Core: 418.50 MHz, Mem: 209.25 MHz

mobile rovclock-0.6c # glxgears

5978 frames in 5.0 seconds = 1195.600 FPS

5958 frames in 5.0 seconds = 1191.600 FPS

5974 frames in 5.0 seconds = 1194.800 FPS

8789 frames in 5.0 seconds = 1757.800 FPS

```

Now, when I manually set the clock speeds to low voltage state speeds, I get this:

```

mobile rovclock-0.6c # ./rovclock -c 105 -m 105

Radeon overclock 0.6b by Hasw (hasw@hasw.net)

Found ATI card on 01:00, device id: 0x4e50

I/O base address: 0xc800

Video BIOS shadow found @ 0xc0000

Reference clock from BIOS: 27.0 MHz

mobile rovclock-0.6c # ./rovclock -i

Radeon overclock 0.6b by Hasw (hasw@hasw.net)

Found ATI card on 01:00, device id: 0x4e50

I/O base address: 0xc800

Video BIOS shadow found @ 0xc0000

Reference clock from BIOS: 27.0 MHz

Memory size: 131072 kB

Memory channels: 1, CD,CH only: 0

tRcdRD:   4

tRcdWR:   2

tRP:      4

tRAS:     9

tRRD:     3

tR2W-CL:  3

tWR:      3

tW2R:     2

tW2Rsb:   1

tR2R:     2

tRFC:     17

tWL(0.5): 2

tCAS:     3

tCMD:     0

tSTR:     1

XTAL: 27.0 MHz, RefDiv: 9

Core: 108.0 MHz, Mem: 108.0 MHz

mobile rovclock-0.6c # glxgears

1558 frames in 5.0 seconds = 311.600 FPS

1867 frames in 5.0 seconds = 373.400 FPS

1869 frames in 5.0 seconds = 373.800 FPS

1869 frames in 5.0 seconds = 373.800 FPS

```

Anyone else experiencing this?[/b]

----------

## ueymir

```
basis / # aticonfig --lsp

X Error of failed request:  BadRequest (invalid request code or no such operation)

  Major opcode of failed request:  145 (ATIFGLEXTENSION)

  Minor opcode of failed request:  13 ()

  Serial number of failed request:  8

  Current serial number in output stream:  8
```

using

```
x11-drivers/ati-drivers

      Latest version installed: 8.20.8

```

I would like to confirm your experience, but I seem to have some trouble with the drivers  :Shocked: 

What amazes me right now is that you have around 3000fps with that card, while I get at most 2100fps. What processor and ram do you have? Me is running 2.6.14-4, 1.6GHz, 512MB.

I might look more into the clock settings thing in a week or so, though.

----------

## TerranAce007

iBuyPower Battalion 101S-Turbo

Mobile AMD64 3200+ (2.0GHz)

1024mb Corsair PC3200

128mb Mobility Radeon 9700

60gb 7200rpm HDD

I got that same error trying to run the aticonfig --lsp on the older 8.18.8, but I don't think that version supports powerplay. Since I already have a method of underclocking the card, I am going back to the stable 8.18.8 drivers. The 8.20.8 freak out when I ctrl-alt to a different console and then try to go back to X. And suddenly my wireless internet refuses to connect automatically at boot, so I have to iwconfig it manually. This may have nothing to do with ATI drivers though, as ipw2200 is still buggy.

----------

## Tlaloc

So you would expect much lower clock speeds showing up in rovclock? I havn't tried out rovclock, but from looking at the temperature difference of up to 10° C between powerstate 1 or 2 enabled I would say that powerplay works as it should.

I have an X600 M24 here with 8.20 ati drivers and hopefully assume right that "/proc/acpi/thermal_zone/TZ2/temperature" refers somewhat to the graphics card   :Rolling Eyes: 

But I also noticed something else. In /var/log/Xorg.0.log I see

```
(II) fglrx(0): POWERplay version 3.  3 power states available:

(II) fglrx(0):   1. 398/250MHz @ 60Hz [enable load balancing]

(II) fglrx(0):   2. 105/122MHz @ 60Hz [low voltage, enable sleep]

(II) fglrx(0):   3. 105/122MHz @ 60Hz [thermal diode mode]

```

but

```
aticonfig --lsp

```

gives only this

```

  core/mem      [flags]

---------------

1: 105/122 MHz  [low voltage]

2: 398/250 MHz  [default state]

```

Contradictory, isn't it?

A question. Where would be the best place to run "aticonfig --set-powerstate=1" at startup so that the power saving mode is active immediately? Unfortunately the entry in xorg.conf added for powerplay doesn't do that. I guess that it should happen right after/before kdm has started? At the moment I have added it to the Autostart folder of kde..

Do you have some info about the status of the radeon driver in xorg 7?

http://ftp.x.org/pub/X11R7.0/doc/html/RELNOTES2.html#5 says

 *Quote:*   

> Full 3D support for r3xx/r4xx series, and PCI-Express

 

but http://ftp.x.org/pub/X11R6.9.0/doc/html/radeon.4.html still this

 *Quote:*   

> R300  
> 
> Radeon 9700PRO/9700/9500PRO/9500/9600TX, FireGL X1/Z1 (2D only)  
> 
> R350  
> ...

 

Hopefully powerplay support will also be there in the radeon driver in the not so distant future.

Bye, Valentin.

----------

## TerranAce007

Well, my card (M11) doesn't have a thermal diode, so I can't tell any temp difference. The cpu gets pretty warm and make its hard to just feel the bottom and tell if the gpu is any cooler. The ati drivers recognize it and I can set powerplay states via aticonfig, but they just doesn't get the clock speeds right. By setting the speeds manually, I see a noticeable difference in battery life, but a max of 10 minutes extra at most.

The method I use to set powerplay states involves setting up a battery runlevel like in the power management guide, then I created a small init script to run either aticonfig or rovclock commands:

```

#!/sbin/runscript

start() {

  ebegin "Setting ATI PowerPlay to Low-voltage Mode"[/quote]

  /root/rovclock-0.6c/rovclock -c 105 -m 105

  #aticonfig --set-powerstate=1

  eend $?

}

stop () {

  ebegin "Setting ATI PowerPlay to Default Mode"

  /root/rovclock-0.6c/rovclock -c 446 -m 216

  #aticonfig --set-powerstate=2

  eend $?

}

```

The general format can be adopted to other things as well, such as power management for wifi:

```

#!/sbin/runscript

start() {

  ebegin "Activating Power Management for Wireless LAN"

  iwconfig eth1 power on power max period 3

  eend $?

}

stop () {

  ebegin "Deactivating Power Management for Wireless LAN"

  iwconfig eth1 power off

  eend $?

}

```

If you want powerplay set atv startup regardless of ac/battery states, just add it to /etc/conf.d/local.start.

```

# /etc/conf.d/local.start

# This is a good place to load any misc programs

# on startup ( use 1>&2 to hide output)

# Fake acpi event to switch runlevel if running on batteries

/etc/acpi/actions/pmg_switch_runlevel.sh "battery/battery"

```

----------

## Tlaloc

 *TerranAce007 wrote:*   

> 
> 
> If you want powerplay set atv startup regardless of ac/battery states, just add it to /etc/conf.d/local.start.
> 
> ```
> ...

 

That does not work since aticonfig needs a running X to set a powerstate.

A happy New Year's Eve!

----------

## blotto

 *Quote:*   

> Code:
> 
>   (II) fglrx(0): POWERplay version 3.  3 power states available: 
> 
>  (II) fglrx(0):   1. 398/250MHz @ 60Hz [enable load balancing] 
> ...

 

Yeah I get similar results.

Have you tried fglrx_pplay

```
albert@acer ~ $ fglrx_pplay

extVersion =     1

extRevision =    1

ppVersion =      3

numPowerStates = 4

flags =          0x60 [power-saving state, overdrive version]
```

```
albert@acer ~ $ fglrx_pplay -

Runaway arguments on the command line: -

Usage:

    fglrx_pplay [-s <s>]           Query POWERplay extension

    fglrx_pplay [-s <s>] -q <n>    Query power state <n>

    fglrx_pplay [-s <s>] -n <n>    Set normal power state <n>

    fglrx_pplay [-s <s>] -t <n>    Set thermal state <n>

    fglrx_pplay [-s <s>] -e <n>    Exit thermal state, <n> should be ignored

    fglrx_pplay [-s <s>] -o <n>    Set overdrive state <n>

General options:

    -s <screen>           Apply to screen <s> instead of the default screen

```

```
albert@acer ~ $ fglrx_pplay -q 4

flags              = 0x120 [enable sleep, thermal diode mode]

validEvents        = 0x2 [thermal]

memClock           = 330.75 MHz

coreClock          = 266.63 MHz

refreshRate        = 60 Hz

```

aticonfig does not see this option !

----------

