Disclaimer of Liability
The content on this page is provided "as is" without express or implied warranty.
In no event shall author be liable for any special indirect or consequential damages or any damages whatsoever resulting from loss of income or profits, whether in an action of contract, negligence or other tortious action, arising in connection with the use or performance of this information.
NVIDIA™ driver for FreeBSD/Linux: performance and power saving hints
Contents
- The document revisions history
- TO DO list
- Performance and power saving
- FreeBSD port of binary NVIDIA driver
- Compatibility
- Useful links
Following information may be useful for NVIDIA chipset-based notebook owners with FreeBSD, Solaris or Linux (Ubuntu/Gentoo/Fedora/RedHat/Debian etc). However, theoretical part of the article is correct for NVIDIA drivers for Microsoft Windows systems.
Note that fan speed on NVIDIA video cards are controlled by different mechanism not described in the article.
Note also that this is not an official documentation and some statements may be wrong!
Need your help
If you have tested (whether successfully or not) following hints on your hardware, could you please drop me a mail to fill a compatibility table. You may also send me your suggestions or discuss the guide in my blog.
The document revisions history
- 2009-02-23 - FreeBSD section cleanup
- 2008-12-10 - add more illustrations, correct Linux-specific things, add compatibility section
- 2008-12-09 - initial revision
TO DO list
- Power consumption and time of work on battery measurements in different modes
- User defined frequencies for 2D/3D operation modes and overclocking ;)
Performance and power saving
General information
Performance levels
NVIDIA binary driver supports several performance levels. Each one has two parameters: GPU clock frequency and on-board memory clock frequency (if the card has one). To see supported performance levels you may use 'nvidia-settings' command. In the example below we have 3 performance levels:Notes:$ nvidia-settings -q GPUPerfModes -t perf=0, nvclock=100, memclock=0 ; perf=1, nvclock=350, memclock=0 ; perf=2, nvclock=425, memclock=0
- The parameter is read-only.
memclock=0means that on-board memory is absent.- Number of available performance levels may vary for different cards (I saw cards with 1, 3 and 4 levels).
- For the same performance level there may be different memclock values for different screen mode BPS (16/32).
NVIDIA driver works in one of these levels each period of time. Following commands will show you current performance level and current frequency parameters:
As for "$ nvidia-settings -q GPUCurrentPerfLevel -t 2 $ nvidia-settings -q GPUCurrentClockFreqs -t 425,666
425,666" in the example above - current GPU frequency is 425 MHz, but the card has
no on-board memory so there should be "425,0" (memclock=0 for perf=2).
Looks like a bug in NVIDIA driver or nvidia-settings tool.
You should not monitor current state of GPUCurrentPerfLevel and GPUCurrentClockFreqs parameters using
'nvidia-settings -q all
NVIDIA X.org driver can detect power source. To see the current state check 'GPUPowerSource' read-only parameter (0 - AC, 1 - battery):
$ nvidia-settings -q GPUPowerSource -t 1
Performance modes
Another one read-only NVIDIA driver parameter is 'GPUCurrentPerfMode' - Performance mode. Possible values are:- 1 - Desktop (2D) - 3D features are not used at the moment;
- 2 - Maximum Performance (3D) - some application is using 3D features.
There is confortable GUI to monitor current status of the driver - just run 'nvidia-settings'
without command-line parameters:
Theory
You may configure power saving behavior for AC and battery sources separately. If your drivers (either NVIDIA or system ones) don't detect current power source correctly, you have to use only one configuration (usually for AC source - check current 'GPUPowerSource' parameter).
Clock frequency control strategies
You may choose clock frequency control strategy for each power source. At the moment we have:strategy=22(hexadecimal)- fixed clock frequency strategy - the card works with a fixed frequency regardless of GPU usage;strategy=33(hexadecimal)- adaptive clock frequency strategy - the card works on maximum power saving level (perf=0) until your applications start to heavily use the card resources, in the case GPU rises current performance level and when the resources are not used anymore, GPU lowers frequency (on one performance level each 15 seconds):
PowerMizer modes
You can not configure some performance level to be used for fixed clock frequency strategy. Instead there are three possible PowerMizer modes for the fixed clock frequency configuration:mode=1- Maximum performance - usually performance level with highest 'perf' (performance level) index is used,mode=2- Balanced - one of medium performance level is used,mode=3- Maximum power saving - usuallyperf=0performance level is used.
PerfLevelSrc - strategies assigment
There is special NVIDIA driver parameter 'PerfLevelSrc'. Its hexadecimal value format is
0x[Battery source strategy][AC source strategy]
Look at following examples:
-
PerfLevelSrc=0x2222- fixed PowerMizer mode (and appropriate fixed frequency) is used for battery power source and fixed PowerMizer mode is used for AC power source, these PowerMizer modes may be the same or different -
PerfLevelSrc=0x2233- fixed PowerMizer mode is used for battery power source and adaptive clock frequency strategy is used for AC power source -
PerfLevelSrc=0x3322- fixed adaptive clock frequency strategy is used for battery power source and PowerMizer mode is used for AC power source -
PerfLevelSrc=0x3333- adaptive clock frequency strategy is used for battery and AC power sources
There are two NVIDIA driver parameters to configure fixed clock frequency strategy:
- 'PowerMizerDefault' - contains PowerMizer mode value to be used for battery power source,
- 'PowerMizerDefaultAC' - contains PowerMizer mode value to be used for AC power source.
Practice
Now we are ready to configure NVIDIA driver.
'RegistryDwords' option from appropriate NVIDIA device section of 'xorg.conf' file is used for the configuration. Minimal configuration may look like follows:Section "Device" Identifier "NVIDIA GeForce" Driver "nvidia" Option "RegistryDwords" "<performance and power saving configuration>" EndSection
The 'RegistryDwords' option format is "parameter1=value1 [; parameter2=value2 ...]" and usually it contains
following parameters:
You have to reload NVIDIA kernel module and restart X.org server to apply the option. Full system reboot will also help."PowerMizerEnable=0x1; PerfLevelSrc=0x<value1>; PowerMizerDefault=0x<value2>; PowerMizerDefaultAC=0x<value3>"
Notes:
- don't forget about hexadecial prefixes - '
0x', especially for 'PerfLevelSrc' parameter; - don't leave trailing ';' in RegistryDwords - Linux version of NVIDIA driver for X.org doesn't support it;
- you must not split RegistryDwords option into several RegistryDwords options, only the first one will be applied.
Configuration examples
Look at four popular 'RegistryDwords' option values:- on battery - max power saving, on AC - max performance
"PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x1"
- on battery - max power saving, on AC - adaptive strategy (my favorite)
"PowerMizerEnable=0x1; PerfLevelSrc=0x2233; PowerMizerDefault=0x3"
- on battery - adaptive strategy, on AC - max performance
"PowerMizerEnable=0x1; PerfLevelSrc=0x3322; PowerMizerDefaultAC=0x1"
- adaptive strategy for any power source
"PowerMizerEnable=0x1; PerfLevelSrc=0x3333"
FreeBSD port of recent binary NVIDIA driver
Recent x11/nvidia-driver port from FreeBSD ports collection should work fine.
- If you have problem with power source detection, make sure that ACPI on your system reports power source changes correctly. After the command
you should see following line when you switch on battery power$ cat /var/run/devd.pipe | grep ACAD
and for AC power there should be!system=ACPI subsystem=ACAD type=\_SB_.PCI0.AC0_ notify=0x00
'type' values may vary, but other parameters should be exactly as specified above.!system=ACPI subsystem=ACAD type=\_SB_.PCI0.AC0_ notify=0x01
If you don't see appropriate messages, check 'acpi_acad' device and 'devd' daemon presense and status of 'hw.acpi.acline' sysctl (0 - battery, 1 - AC).
$ devinfo |grep acpi_acad acpi_acad0 $ /etc/rc.d/devd status devd is running as pid 562. $ sysctl hw.acpi.acline hw.acpi.acline: 1 - You may wish to configure performance and power saving mode - see details above.
- To apply the driver installation (or replacement) you should load (or reload) nvidia.ko kernel module
and restart your X.org server. Full FreeBSD server reboot will also help.
If you haven't used the driver before, you should configure X.org accordingly.
It is also recommended to install x11/nvidia-settings FreeBSD port to monitor current driver state.
Compatibility
| OS/kernel release/version |
NVIDIA hardware (PCI ID) |
NVIDIA driver version | Performance levels | Features | ||||
|---|---|---|---|---|---|---|---|---|
| power source detection | adaptive strategy | fixed frequency - PowerMizer modes |
||||||
| 1 - max perf. | 2 | 3 - max power saving | ||||||
| on-board GeForce Go 6100 (0x10de:0x0247, rev=0xa2) | 180.18 | perf=0, nvclock=100, memclock=0; perf=1, nvclock=350, memclock=0; perf=2, nvclock=425, memclock=0 |
yes | yes | perf=2 | perf=1 | perf=0 | |
| Notes: Works fine. | ||||||||
| Linux 2.6.27-9-generic x86_64 | 2x GeForce 8700M GT SLI (0x10de:0x01b3, rev=0xa3) | 180.11.02 | perf=0, nvclock=170, memclock=100; perf=1, nvclock=275, memclock=300; perf=2, nvclock=625, memclock=800 |
yes | no | no | no | no |
| Notes: Default behavior with Option "SLI" "false" or Option "SLI" "SFR" is max performance on AC and max power saving on battery. PerfLevelSrc has no effect. | ||||||||