Various people have complained about 8400M GS (and, in general nvidia laptop cards under linux) and, most people have suggested using the PerfLevelSrc hack in /etc/modprobe.d/options but, after doing a test of how much battery life I was losing keeping the card at max speed at all times (Almost 1 hour on a Dell XPS m1330), I decided to write these two scripts that emulate the performance benefits of PerfLevelSrc on AC power while still giving you maximum battery life.
I've only tested this on a 8400M GS with Ubuntu 7.10 but, it should work for any laptop that uses Adaptive Clocking. I just switched to this from PerfLevelSrc today but, so far, I'm getting the same desktop experience on AC power and nearly an extra hour of battery life when unplugged (and I don't have to use any spooky modprobe hacks). Once you have the first script running in the background and the second script installed, you'll need to get things rolling by switching to/from AC/battery (so, either unplug the machine for a second if you are plugged in or plug it in if you are on battery). After that it should just work as long as you run the first script at login time.
Note: If you are currently using the PerfLevelSrc hack in /etc/modprobe.d/options, you'll need to remove it and reboot before you'll see any benefit from these scripts.
$ cat nvidia-power.sh
while true; do
if [ -f /tmp/nv-power-on ]; then
nvidia-settings -q all > /dev/null
Save this script somewhere and run it when you login. I'm not going to describe how to do that but, ask if you don't know. The script essentially forces the card to maximum power every 25 seconds if /tmp/nv-power-on exists.
The second script is an init script that hooks into the acpi system. It adds/removes the lock file that the first script looks for. If you use compiz and the OnDemandVBlankInterrupts option in xorg.conf, there are additional options that you can uncomment to save more power while on batteries. The directions for installation are at the top of the file.
$ cat 99-nvidia.sh
# A companion script to nvidia-power.sh that removes/adds the lock that
# tells the script whether or not it should force the card into it's highest
# frequency every 25 seconds. Think of it as sort of a poor mans powermizer
# Also, see the two comments marked OPTION if you wish to save more power
# using OnDemandVBlankInterrupts and compiz.
# On Ubuntu install this script with the following commands:
# sudo install 99-nvidia.sh /etc/acpi/start.d
# sudo install 99-nvidia.sh /etc/acpi/resume.d
# sudo install 99-nvidia.sh /etc/acpi/ac.d
# sudo install 99-nvidia.sh /etc/acpi/battery.d
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
if [ x"$XAUTHORITY" != x"" ]; then
if on_ac_power; then
# OPTION: Uncomment next line to turn on compiz vsync when the
# laptop is plugged in
# su $user -c "gconftool-2 --type boolean --set /apps/compiz/general/screen0/options/sync_to_vblank 1"
su $user -c "nvidia-settings -q all > /dev/null"
# OPTION: Uncomment next line if you use compiz and have
# OnDemandVBlankInterrupts set to true in xorg.conf. This will
# remove the ~60 wakeups a second that compiz causes the nvidia
# driver to do.
# su $user -c "gconftool-2 --type boolean --set /apps/compiz/general/screen0/options/sync_to_vblank 0"
rm -f /tmp/nv-power-on
I hope others find this useful. Let me know if you have any questions or problems.