How does Bumblebee work with Optimus NVIDIA GPU
What is bumblebee? Sounds like the name of an Insect or perhaps you would recognize it with the Transformer Series of Movies. The yellow Car which uses the voices from the Car's Audio system, to talk to people. Well all this is true, However What I am referring to is entirely different and it concerns Linux. Especially Linux on Computers with the Optimus Graphic Cards from Nvidia. These systems are very different from the traditional single graphics Card systems. In Traditional systems what would happen on the desktop and laptop computers is that, you would have only one graphics card. Either an Integrated graphics card or a dedicated graphics card.
What if your system had the option of having both types of cards. I mean if a computer had an Integrated graphics card capable enough of running most of the graphics stack on your computer, and onother dedicated Card to handle the heavy duty gaming stuff, How would things be then ? How would one manage the graphics cards and their settings then?
This is mostly achieved in modern hardware by using a combination of an Intel Integrated GPU and a secondary discrete NVIDIA gpu. The technology is called as Optimus. Well most of the latops these days come with the NVIDIA/INTEL Optimus setup. However having the technology at the hardware level only is not sufficient. We need to have a software stack which would then use the technology within the Operating Systems. How do we achieve this? and Quite Frankly Microsoft Windows leads in this area as the most widely used Desktop operating system hence with windows, The Optimus Technology is quite well supported out of the box wth almost zero effort on the user's part. Whenever a graphics intensive application is launched the system automatically switches to the more powerful NVIDIA GPU. Which is great as the user gets great performance without having to worry about anything. When there is no need for the NVIDIA GPU, the System automatically switches back to the Intel Integrated GPU. The result being more efficient utilization of the system resources and Improved battery life with optimum performance for you graphic intensive applications.
Well that is how it was supposed to work. However that is true only on the windows side of the world. We know MS Windows is not the end of the world. So we now talk a bit about Linux. With Linux the road is a bit bumpy, however we also have a perfect solution for Linux. We rather have two solutions to the same problem. I will cover both in this POST.
We need to understand one basic fact that with Linux, the automatic switching from Intel to NVIDIA GPU and Vice Versa is not yet supported. We can switch however user intervention is needed. Apart from this there is no other caveat to this.
The First Option is called NVIDIA PRIME. Under NVIDIA Prime, One Installs nvidia drivers alongwith the nvidia prme and nvidia-settings. In this method Nvidia-Settings program is used to switch between the driver. One can use only on GPU at one time. The Entire System will use on GPU at one time. We can Change and choose Which GPU we want however after selecting we need to logout of the session and start a new session. So this is a soluion requiring the least amount of configuration and consequently we have to live with the fact that we need to switch he graphic Card for the whole system and start a new session to use the newly selected GPU.(This works only with Nvidia Closed Source Drivers supplied by NVIDIA)
The Second Option is called the Bumblebee !! you hear it .. It is indeed called Bumblebee. Well I am not going to go into why it is called so, the fact of the matter is that it is a great solution to use in case you have the Optimus based hardware like I have. It allows you to select the GPU at run time by selecting which application you would want to run on the dedicated GPU. Yes it is true. You can launch applications to use a the high power NVIDIA GPU. By default the system always uses the Integrated Intel GPU. However when needed you can launch a application specifically targeting the NIDIA GPU.Not only that this works well with NVIDIA Closed Source Drivers but with the nuoveau Open Source Drivers as well.
I am going to be elaborating a more on the Bumblebee Stuff as there is still a lot of confusion for the new users to Linux as to how it exactly works. Bumblebee is a very Interesting piece of software. It is however often misunderstood and hence not everyone prefers it. But I strongly recommend it. Almost all Linux Distros have a small wiki dedicated to how to get Bumblebee working. There is a special case of Ubuntu and anything based on Ubuntu that I would like to point this article to.
If there is a new user ever starting the switch from Other Operating Systems to Linux, there is a high chance that he will land on to a Ubuntu or Ubuntu Spin. If the user has an Optmus Laptop then things become really Interesting. The user is used to out of box experiences and Linux in this case does not offer one. So there needs so be a specific wiki/documentation for this. There is however i personally believe it is not sufficient. There are some specfics which I think are still not covered in any Wiki for Ubuntu. I am going to focus on Ubuntu beause I fee Ubuntu documentation on bumblebee is poor.
Ok let us Understand the Operation and how it to be correctly configured.
While using Bumbelee to control the Optimus/Hybrid graphics on a laptop we must understand that Bumblebee takes total control of the Driver or the Nvidia Graphics Card. This means that Bumblebee Daemon controls the loading and unloading of the Driver. The Module for Loading the Graphics Drivers for Nvidia Cards, Namely Nouveau and nvidia-XXX driver is to be controlled by Bumblebee.
So here is a few things one needs to ensure while configuring bumblebee on Ubuntu. We need to ensure that the Driver/Kernel Module for the NVIDIA CARD is completely Blacklisted so that it never loads automatically. We want bumblebee to completely control this card.
This can be done as below.
- Blacklist Noueau Driver so it does not load automatically. (This is generally done Automatically by the Bumblebee Install.) Config Files to look at. /etc/modprobe.d/nvidia-XXX_hybrid.conf in case you Installed your Nvidia Proprietary Drivers alongwith Bumblebee. If you do not plan on using only Noveau, Then you must manually create a /etc/modprobe.d/blacklist-nouveau.conf and add one line to it, blacklist nouveau.
- Blacklist the NVIDIA-XXX Driver , We need to ensure that the NVIDIA-XXX driver needs to stay blacklisted as well. This most likely shoul happen automatically however if you are using any driver newer thatn Nvidia-331, Then it is a good option to look in /etc/modprobe.d/bumblebee.conf. This file is automatically generated while Installing Nvidia Graphics Drivers after installing Bumblebee. If you do not see the driver you are using in the file, you must add it manually.
- Automatically load i915 Driver for Intel card. We need to add bbswitch and i195 to the /etc/modules file. This is because we want the bbswitch module to load automatically, this is what actually turns on and off the Nvidia Graphics Card. We also want that the Intel Integrated Card to be in use always so we add that to the file.
The above three steps ensure that we have only Intel Card enabled by default and Nvidia Drivers completely removed from getting automatically loaded. We also are loading he bbswitch module automatically which will actually switch the Nvidia Gaphics Cad ON and OFF when launching any program using optirun or primusrun prefix from the terminal. These two are the commands that need to be prefixed while launching wine or Steam depending on which of these you use or gaming. Or any other program which needs some Juice from the Nvidia Graphics Card.
Configure Bumblebee to use your Nivida-Drivers
The Only other piece of configuration that needs to be done is as below.
sudo gedit /etc/bumblebee/bumblebee.conf
1. line 22:
2. line 55:
3. line 58:
4. line 61:
5. Reinstall bbswitch-dkms:
sudo apt-get install --reinstall bbswitch-dkms
Note:- Just ensure that you replace nvidia-331 with the driver you have Installed.
If you are planing to use Nouveau driver then you don't need the above configuration, I will automatially work with Nouveay driver.
I now hope that after readin this post, many Ubuntu Users will understand the Bumblebee Concepts Clearly.