Dedicated Nvidia GPU
Having a dedicated graphics processing unit ( GPU or graphics card ), boosts graphics performance significantly, especially when playing 3d games.
Nvidia GPUs are very popular on desktop computers and they work very well on linux, as drivers are available from Nvidia.
It is necessary to install the right drivers to ensure proper utilisation GPU. Otherwise the performance would be limited, or totally unused.
Nouveau - the default driver
For Nvidia GPUs, the Nouveau driver becomes active by default. Nouveau is the open source driver for Nvidia GPUs.
Check it with the lspci command.
$ lspci -vnn | grep VGA -A 12 01:00.0 VGA compatible controller : NVIDIA Corporation GT218 [GeForce 210] [10de:0a65] (rev a2) (prog-if 00 [VGA controller]) Subsystem: ZOTAC International (MCO) Ltd. Device [19da:1160] Flags: bus master, fast devsel, latency 0, IRQ 16 Memory at e2000000 (32-bit, non-prefetchable) [size=16M] Memory at d0000000 (64-bit, prefetchable) [size=256M] Memory at e0000000 (64-bit, prefetchable) [size=32M] I/O ports at 2000 [size=128] Expansion ROM at e3080000 [disabled] [size=512K] Capabilities: <access denied> Kernel driver in use: nouveau
The last line indicates the kernel driver in use, which is nouveau over here. However with the Nouveau driver the gpu cannot perform to its full potential and features like hardware 3d acceleration would be unavailable or limited.
The official nvidia drivers would make the gpu deliver its full performance.
Testing graphics performance
It might be interesting to compare the graphics performance with different drivers and to ensure that the gpu is indeed performing well. For this we use 2 little utilities called glmark2 and glxgears.
The glxgears command would popup a small window with an animation of rotating gears. It would then print out the fps every 5 seconds on the terminal.
$ vblank_mode=0 glxgears ATTENTION: default value of option vblank_mode overridden by environment. 4589 frames in 5.0 seconds = 917.740 FPS 4714 frames in 5.0 seconds = 942.641 FPS 4717 frames in 5.0 seconds = 943.335 FPS 4718 frames in 5.0 seconds = 943.558 FPS 4713 frames in 5.0 seconds = 942.536 FPS .....
Note down the fps, which is around 940 in this case. Next run the glmark2 command, and let it complete all tests and at the end it would show a score.
$ glmark2 ======================================================= glmark2 2012.08 ======================================================= OpenGL Information GL_VENDOR: nouveau GL_RENDERER: Gallium 0.4 on NVA8 GL_VERSION: 3.0 Mesa 9.2.1 ======================================================= [build] use-vbo=false: FPS: 420 FrameTime: 2.381 ms [build] use-vbo=true: FPS: 430 FrameTime: 2.326 ms ..... OUTPUT TRUNCATED ..... ======================================================= glmark2 Score: 336 =======================================================
So with the Nouveau drivers, the glmark score is 336 and glxgears max FPS is around 940.
Setup Nvidia proprietory drivers
Now install the Nvidia proprietory drivers. The Nvidia drivers are available in the Ubuntu repositories but they are mostly out of date.
The drivers are named like nvidia-331, nvidia-319, nvidia-304 and so on. Each driver supports a different set of graphics card.
So first of all find the right driver for your GPU
1. Check the graphics card model
Check the model of your GPU chipset with the lspci command.
$ lspci -vnn | grep VGA -A 12 01:00.0 VGA compatible controller : NVIDIA Corporation GT218 [GeForce 210] [10de:0a65] (rev a2) (prog-if 00 [VGA controller]) .....
The model of the graphics chipset is, NVIDIA Corporation GT218 [GeForce 210]. Now we need to find the right driver for this card.
2. Find the correct driver from nvidia site
Go to http://www.nvidia.com/Download/index.aspx and select your model and click Search.
On the next page, you would get all details about the driver, version, release date, supported chipsets and further information about how to install it.
For the above GeForce 210 card, it showed 331.67 as the correct driver which can be downloaded from the website as .bin file. However we shall install the drivers from ppa to make things easier.
3. Configure the ubuntu-x-swat PPA
The ubuntu-x-swat ppa provides updated versions of nvidia drivers for ubuntu.
$ sudo add-apt-repository ppa:ubuntu-x-swat/x-updates -y $ sudo apt-get update
If you are looking for the very latest drivers then try another ppa called xorg-edgers.
$ sudo add-apt-repository ppa:xorg-edgers/ppa -y $ sudo apt-get update
After adding the new ppas, you can check the new drivers and their versions by running To list the Nvidia drivers available in the repository search using the aptitude command
$ aptitude versions ^nvidia
Or open the Synaptic Package manager and search for packages named nvidia. Now that the ppas are setup, we are ready to install the driver.
4. Install the driver from Driver Manager
We shall use the Driver Manager to install and activate the driver. Go to System Settings > Driver Manager (Under Administration)
Select the driver (nvidia-331) and click Apply. It would then download the necessary packages for the selected driver, install it and configure it. Once the Driver Manager finishes, restart the machine for the new drivers to take effect.
Verify the new driver
After the reboot, check the graphics driver using the lspci command again.
$ lspci -vnn | grep VGA -A 12 01:00.0 VGA compatible controller : NVIDIA Corporation GT218 [GeForce 210] [10de:0a65] (rev a2) (prog-if 00 [VGA controller]) Subsystem: ZOTAC International (MCO) Ltd. Device [19da:1160] Flags: bus master, fast devsel, latency 0, IRQ 16 Memory at e2000000 (32-bit, non-prefetchable) [size=16M] Memory at d0000000 (64-bit, prefetchable) [size=256M] Memory at e0000000 (64-bit, prefetchable) [size=32M] I/O ports at 2000 [size=128] [virtual] Expansion ROM at e3080000 [disabled] [size=512K] Capabilities: <access denied> Kernel driver in use: nvidia
This time it shows the nvidia driver in use.
Alternatively use the inxi command to check graphics card information
$ inxi -Gxx Graphics: Card: NVIDIA GT218 [GeForce 210] bus-ID: 01:00.0 X.Org: 1.14.5 drivers: nvidia (unloaded: fbdev,vesa,nouveau) Resolution: [email protected] GLX Renderer: GeForce 210/PCIe/SSE2 GLX Version: 3.3.0 NVIDIA 331.20 Direct Rendering: Yes
Information about the X driver (nvidia) and OpenGL extensions (GLX Renderer and GLX Version) are mentioned. Note that the GLX Renderer is GeForce, which indicates the Nvidia libraries are used for direct rendering. In other words hardware 3d acceleration is enabled, which would make 3d games and applications work very well.
Check the OpenGL configuration with glxinfo command. The output should contain details about the Nvidia driver currently in use.
$ glxinfo | grep OpenGL OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce 210/PCIe/SSE2 OpenGL core profile version string: 3.3.0 NVIDIA 331.20 OpenGL core profile shading language version string: 3.30 NVIDIA via Cg compiler OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.3.0 NVIDIA 331.20 OpenGL shading language version string: 3.30 NVIDIA via Cg compiler .....
Check the dependencies of glxgears.
$ which glxgears /usr/bin/glxgears $ ldd /usr/bin/glxgears | grep GL libGL.so.1 => /usr/lib/nvidia-331/libGL.so.1 (0x00007f4fb3664000)
The libGL line pointing to a nvidia library (nvidia-331 here), indicates that the Nvidia-331 driver is being used for OpenGL.
Test the performance of the new driver
Now that we replaced the Nouveau drivers with Nvidia drivers, its time to benchmark the gpu performance to get a comparison.
First run nvidia-settings (or launch from Menu > Administration > Nvidia X Server Settings) and go to OpenGL Settings and uncheck "Sync to VBlank".
$ glxgears 15102 frames in 5.0 seconds = 3020.005 FPS 15965 frames in 5.0 seconds = 3192.975 FPS 16011 frames in 5.0 seconds = 3202.142 FPS 15994 frames in 5.0 seconds = 3198.785 FPS 15971 frames in 5.0 seconds = 3194.179 FPS .....
Note that the FPS is above 3000, which is way higher than what it was with the Nouveau drivers.
Run glmark2 and check the score.
$ glmark2 ======================================================= glmark2 2012.08 ======================================================= OpenGL Information GL_VENDOR: NVIDIA Corporation GL_RENDERER: GeForce 210/PCIe/SSE2 GL_VERSION: 3.3.0 NVIDIA 331.20 ======================================================= [build] use-vbo=false: FPS: 671 FrameTime: 1.490 ms [build] use-vbo=true: FPS: 747 FrameTime: 1.339 ms .....OUTPUT TRUNCATED..... ======================================================= glmark2 Score: 547 =======================================================
The score is around 550 which is a lot better than the score of Nouveau drivers. So the nvidia drivers are installed and working perfectly fine.
The nvidia driver comes with a gui tool called nvidia-settings, that can be used to configure the displays. Find it in the Administration menu, or run it from command line.
To check the hardware information about the GPU, click on GPU 0 on the left.