Monday, June 10, 2013

[How to] Enable nVidia drivers with Optimus technology in Linux

Enable nVidia drivers with Optimus technology in Linux

¿De qué está hablando? Versión en español

Now that I actually have a computer with a graphic card, I can write about how to enable it, if it isn't recognized by your OS.

 
I have a nVidia GeForce 620m in my laptop and it isn't recognized because it uses the Optimus technology from nVidia.

Checking your device


First of all let see if your graphic card is recognized in a hardware level.
Use the command:

lspci

You can be more specific, combine lspci with grep.

lspci | grep 3D


Now that we have that, we can install the corresponding driver.

Downloading and installing Bumblebee


Bumblebee is a project that was born to enable Optimus technology. It is supported in most distros (Ubuntu, Fedora, Mandriva, Arch...). Since I am using Ubuntu I will show you how to install it using a PPA.

Important: You don't need anything extra, don't install nvidia-current and don't run any configuration file.

Use the official PPA from the Bumblebee website and update the packages:

sudo apt-add-repository ppa:bumblebee/stable
sudo apt-get update

Make sure you have the linux headers package installed:

sudo apt-get install linux-headers-generic

And finally install Bublebee:

sudo apt-get install bumblebee virtualgl

Then reboot your computer and check if you don't have any errors.

Make sure that you have the option for hybrid cards enabled in your BIOS too.

Testing the graphic card


Now that we have Bumblebee installed we can check if it is actually running, since there isn't any User Interface.

Let's do some benchmarking first. Run the following command to test the GPU from the processor:

glxspehres

This program will show you a 3D animation you can check the FPS rate and more information. In my case here is the output of my computer:



Now let's make a test with Bumblebee and VirtualGL. Let's run glxspheres but in the nVidia card:

optirun glxspheres



Now that we can use the nVidia card we can improve the performance in order to save power and to get better rendering.

Note: You can actually see in the screenshots how the battery life drops when the graphic card is used.
 

Adding Primus for better performance


In order to get better performance  you can install another "bridge" that is going to be used by Bumblebee. Install Primus with the command:

sudo apt-get install primus

Then you can test the performance with this:

vblank_mode=0 primusrun glxspheres

(You need the vblank_mode option to get the maximum FPS rate)


Note: Again you can see that the battery life is reduced but not as much as when you run the program with optirun.

Running games with your graphic card in Steam


If you want to run your Steam games with your graphic card you just need to change some Settings in the Steam client.

Launch the client and go to your Library. Then select the game you want to launch and right-click in it.
Go to "Properties"


Then choose "SET LAUNCH OPTIONS..."


And enter the command primusrun %command%.


That's it! Your games will run in the graphic card.

Did you like this post? Don't forget to add me to your circles in G+ or to follow me on Twitter: @RobertoXMed .

If you can and if you want, don't forget to Donate so I can keep up the good work.

1 comment:

  1. Should nvidia drivers be uninstalled before installing this ppa?

    ReplyDelete