The NVIDIA X Server Settings app for Linux lets us tune the performance of our NVIDIA display adapter. On a laptop this is especially important as it lets you enable the power-saving features of the adapter to extend battery life. The adapter (and the settings app) default to “Adaptive” mode, which is a balanced mode that can scale up for performance but scale down for battery-savings.
The problem with Adaptive mode is that it doesn’t kick in as quickly as you might like. You’ll notice choppy behavior when scaling windows in Unity, etc. So if you customarily employ your laptop “like a desktop” or just want to force full-time maximum performance mode, the settings app will let you do so.
But wait, there’s a catch: the performance settings don’t seem to persist across reboots or even across logout/logins. The adapter will revert to Adaptive mode every time. This necessitates the annoyance of remembering to run the X Server Settings app each time you log in in order to re-set the power mode.
I have good news. There’s a straightforward hack to force maximum performance while on A/C power and fall back to the adaptive strategy while on battery. And the beauty of the hack is, you don’t need to touch the NVIDIA X Server Settings app at all for this. All you have to do is add a few configuration items to your Xorg configuration.
In Ubuntu Oneiric 11.10, you no longer edit the xorg.conf file like you did in previous distributions. You simply place configuration files in
/usr/share/X11/xorg.conf.d/ and they will be loaded at X startup. For this hack, make a file
/usr/share/X11/xorg.conf.d/05-nvidia.conf and put in it:
VendorName "NVIDIA Corporation"
BoardName "NVS 140M"
Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3322; PowerMizerDefaultAC=0x1"
Note that Identifier, BoardName etc. are indicative of my Lenovo Thinkpad T61 and may not match your own hardware. However, these lines are largely irrelevant to the way X runs. The key is the Option line. These configuration items direct the NVIDIA adapter how to handle performance scaling.
You can see exactly what these hex values mean and learn some other possibilities for the values by consulting this reference.