Bumblebee is a solution to Nvidia Optimus hybrid-graphics technology allowing to use the dedicated graphics card for rendering.
Optimus Technology is an hybrid graphics implementation without a hardware multiplexer. The integrated GPU manages the display while the dedicated GPU manages the most demanding rendering and ships the work to the integrated GPU to be displayed. When the laptop is running on battery supply, the dedicated GPU is turned off to save power and longer the battery life.
Bumblebee is a software implementation based on VirtualGL and the Nvidia proprietary kernel module to be able to use the dedicated GPU, which is not physically connected to the screen.
This article will describe how to configure Bumblebee.
AUR package: bumblebee This package depends on other packages from the AUR:
- dkms-nvidia compiles the Nvidia dynamic kernel module.
- nvidia-utils-bumblebee contains the graphics libraries from Nvidia installed in a different directory to be used simultaneously with libgl.
- VirtualGL sends commands to a server-side 3D graphics card.
In order to make Bumblebee functional you will need to configure a second X server, load the nvidia kernel module and run the bumblebee daemon.
This article section describes the use of proprietary Nvidia module. Nouveau module can be used but it's not tested as 3D acceleration it's still not supported. You can test it by changing the driver of the X server and loading the appropriate libGL in the optirun script.
Load Kernel Module
Bumblebee needs the proprietary Nvidia kernel module to run properly. You need to unload the Nouveau kernel module first. To do so run in a terminal:
# rmmod nouveau
Now load the Nvidia module running this:
# modprobe nvidia
To check for success of loading the kernel module, check the output of this command:
$ lspci -k | grep nvidia
It should be something like this:
Kernel driver in use: nvidia
Setup X Server
After installation a Template:Filename file is created with the minimal device configuration. Please check for this file with
$ ls /etc/X11
# cp /etc/X11/xorg.conf.nvidia.pacnew /etc/X11/xorg.conf.nvidia
In this file you must specify the PCI bus address of the Nvidia card. To get it run in a terminal:
$ lspci | grep VGA
This will give you something like this:
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 18) 01:00.0 VGA compatible controller: nVidia Corporation GT218 [GeForce 310M] (rev a2)
Start Bumblebee Daemon
Bumblebee provides a daemon to start the second X server, to start it simply run:
# rc.d start bumblebee
Start VirtualGL Client
Run this command in a terminal:
$ vglclient -gl
This command should be run as normal user after X server starts. There are some cases where only the properly set of 'DISPLAY' environment variable is enough to run vglrun command.
You can test Bumblebee by comparing the output of these two commands:
$ optirun glxgears
To launch an application using the dedicated graphics card:
$ optirun <application> [application-parameters]
If you want to run a 32-bit application on a 64-bit system you may use instead:
$ optirun32 <application> [application-parameters]
You may configure VGL variables in file Template:Filename. The defaults are:
You can try different compression methods adding the '-c <compress-method>' to the vglrun command and test which suits you best:
$ vglrun -ld /usr/lib/nvidia-current -c jpeg glxgears $ vglrun -ld /usr/lib/nvidia-current -c proxy glxgears $ vglrun -ld /usr/lib/nvidia-current -c rgb glxgears $ vglrun -ld /usr/lib/nvidia-current -c yuv glxgears
And you can replace the one you like in VGL_COMPRESS environment variable in Template:Filename.
If you want bumblebee to start at boot, do the following. Add the Nvidia module in the "MODULES" array in your Template:Filename:
MODULES=(... nvidia ...)
Add "bumblebee" to the "DAEMONS" array in your Template:Filename:
DAEMONS=( ... dbus bumblebee ...)
Nvidia Card ON/OFF Scripts
First unload the Nvidia kernel module. This is necessary to avoid system freeze after turning off the discrete card. If you receive an error of the Nvidia module to be in use, then you must stop Bumblebee daemon before unload the module:
# rc.d stop bumblebee # modprobe -r nvidia
Now open a terminal and run this command to check your battery rate (default update interval is 2 seconds):
$ watch grep rate /proc/acpi/battery/BAT0/state
You can manually turn on/off dedicated card by calling methods of acpi_call module. First you must test for a method call to turn off the discrete card:
Should output something like this:
Trying \_SB.PCI0.P0P1.VGA._OFF: failed Trying \_SB.PCI0.P0P2.VGA._OFF: failed Trying \_SB_.PCI0.OVGA.ATPX: failed Trying \_SB_.PCI0.OVGA.XTPX: failed Trying \_SB.PCI0.P0P3.PEGP._OFF: failed Trying \_SB.PCI0.P0P2.PEGP._OFF: failed Trying \_SB.PCI0.P0P1.PEGP._OFF: works!
The method that "works!" is what you need to turn off your discrete graphics card by this command:
# echo "\_SB.PCI0.P0P1.PEGP._OFF" > /proc/acpi/call
You should notice a decrease on power usage of about 200 ~ 300 mA. To turn back on the discrete card you must call a similar method but with OFF replaced by ON:
# echo "\_SB.PCI0.P0P1.PEGP._ON" > /proc/acpi/call
Then you can reload the Nvidia kernel module:
# modprobe nvidia
If you could complete this steps then you would be able to use power management in Bumblebee.