Welcome to the Slackware Documentation Project

Nvidia Optimus

Some newer laptops nowadays come with what is known as “nVidia Optimus” technology. This is an nVidia and Intel hybrid graphical processing unit (GPU); it is NOT two separate GPUs in one laptop. It uses nVidia graphics for performance and Intel graphics for power saving during basic usage. Unfortunately the closed source proprietary drivers do not offer a means for adjusting or switching between the two, unlike those from Advanced Micro Devices Inc. (AMD).

Despite this disappointment, there is an open source project called Bumblebee that aims to fix this problem. However, Bumblebee isn't alone. nVidia developers do assist the Bumblebee project by fixing bugs in the closed source proprietary drivers that Bumblebee developers cannot touch.

To avoid confusion, from here on we will be using nVidia to refer to the company and nvidia to refer to the closed source proprietary driver. New sentences that start with nVidia also refer to the company and Nvidia to the driver.

You should also note the terminal commands used on this page. The code lines that begin with $ refers to commands to be run by a regular user, and # refers to commands to be run as root or a user with sufficient privileges.

Also please note the differences between Bumblebee and bumblebee. bumblebee is the daemon for bumblebee.

X11 and Other Programs without Bumblebee

You do NOT need to use Bumblebee in order to use X11, KDE, Compiz-Fusion, Blender, Adobe Flash Player and even some games such as Guild Wars or Warcraft III. The Intel graphics provides enough 3-D acceleration (and sometimes has better performance) for those programs to work smoothly without having to use the nVidia GPU. In addition to the programs working efficiently and smoothly, you're saving power.

If you still wish to use Bumblebee to switch between the nVidia GPU and the Intel GPU, read on. We just wanted to clarify that Intel's 3-D acceleration has progressed quite far and that not all programs need to use the nVidia GPU in order to work.

Installing Bumblebee


Getting the SlackBuilds

A fellow Slacker, jgeboski, originally provided SlackBuilds that mostly follow the SlackBuilds.org requirements for Bumblebee. Now, another Slacker has taken over where he has left off on his own github repo. Remember to check which directory you're in first, as they will be downloaded to that directory. Assuming you're ready, the SlackBuilds can simply be git cloned as such. Then we're going to change into the new directory and begin the build process.

$ git clone https://github.com/whitewolf1776/Bumblebee-SlackBuilds.git
$ cd Bumblebee-SlackBuilds

Or you can download the full tarball containing the SlackBuilds instead:

$ wget --content-disposition https://github.com/whitewolf1776/Bumblebee-SlackBuilds/tarball/master
$ tar -xf whitewolf1776-Bumblebee-SlackBuilds-<changing hexadecimal>    # Tab completion is helpful.
$ cd whitewolf1776-Bumblebee-SlackBuilds

There is a README file, but you probably won't be reading it as you're reading this instead, so we're basically going to post it here.

Getting the Dependencies

The dependencies, as with all SlackBuilds, must be downloaded manually and placed into their respective directories. However the SLACKBUILDS.TXT file does give links for the downloads as well as their MD5SUMs to make sure the files were not corrupt. You can use the provided script to download them and check them against their MD5SUM for corruption, like this:

./download.sh

Preparing the Environment

There are a few things you need to do before we begin. First off, we need to have a specific group of users who are going to be allowed access to Bumblebee technology. For the sake of simplicity, we'll call this group “bumblebee”. In addition to the new group, we need to add the users that are allowed to access bumblebee technology:

# groupadd bumblebee
# usermod -G bumblebee -a <USERNAME>

where <USERNAME> is the name of the user or users you would like to add.

Building and Installing Bumblebee's Core

1. Build and install: bbswitch (optional but highly recommended), libbsd and bumblebee in order as you go.

# cd bbswitch # You don't actually need to ''cd'' as root, but who wants to ''su'' all the time?
# ./bbswitch.SlackBuild
# upgradepkg --install-new bbswitch-*.t?z
# cd ../libbsd
# ./libbsd.SlackBuild
# upgradepkg --install-new libbsd-*.t?z
# cd ../bumblebee
# ./bumblebee.SlackBuild
# upgradepkg --install-new bumblebee-*.t?z

Building and Installing Other Dependencies

Some SlackBuilds also offer a COMPAT32 option if you're running a multilib system. In the following examples, we build it with and without 32-bit compatibility. Use the one you desire. Keep these in mind when building the specified package.

Bumblebee can use either primusrun (requires a mesa rebuild in Slackware 14.0 and below) or bumblebee's own optirun. Take your pick which one you would like to use (or you can install both). Each one has their own advantages and disadvantages.

VirtualGL

Although VirtualGL (and its dependency libjpeg-turbo) are still supported by the Bumblebee project and maintained by their developers, the new github repo does not include SlackBuild scripts for these packages. This section is for the old github repository that was once maintained by jgeboski. If you would like to use VirtualGL (e.g. you're in one of the rare cases where VirtualGL provides better performance than primus) then you can use your own personal SlackBuilds or the old ones (although the old SlackBuilds will be out-of-date).

1. Build and install: libjpeg-turbo (32-bit compatibility available)

# cd ../libjpeg-turbo
# ./libjpeg-turbo.SlackBuild                         # This does not build with 32-bit compatibility.
# upgradepkg --install-new libjpeg-turbo-*.t?z

If you do wish to build with 32-bit compatibility, add COMPAT32=yes before executing the script as so:

# COMPAT32=yes ./libjpeg-turbo.SlackBuild  # Only for 32-bit compatible binaries and libraries on an x86_64 based system.

libjpeg-turbo installs in /opt because otherwise it can overwrite some things from the original libjpeg.

2. Build and install: VirtualGL (32-bit compatibility available)

# cd ../VirtualGL
# ./VirtualGL.SlackBuild
# upgradepkg --install-new VirtualGL-*.t?z

I think you're starting to get the idea now…

# COMPAT32=yes ./VirtualGL.SlackBuild

Primus

Primus is another program designed to be used much like optirun. However, primus does not require VirtualGL (and therefore will not require libjpeg-turbo as well) but only requires mesa with --enable-shared-glapi (Slackware 14.0 and below must have mesa rebuilt). Primus also comes with a COMPAT32 option as well.

The new github repository does not offer a SlackBuild for mesa to support Slackware 14.0 or older. Therefore you must use Slackware 14.1 or newer, or rebuild mesa manually with a different script. One can choose to use the old repository and simply update the SlackBuild script appropriately, or add --enable-shared-glapi into a mesa.SlackBuild from the source of a newer Slackware version.

# # For the old repository, one would have done:
# cd ../mesa
# ./mesa.SlackBuild

mesa does not have a COMPAT32 option because it is an official Slackware package, but you can easily create the compat32 package after creating the original package by using:

# ./mesa-compat32.SlackBuild # Only in the old repository

1. Build and install: primus

# cd ../primus
# ./primus.SlackBuild
# upgradepkg --install-new primus-*.t?z
# COMPAT32=yes ./primus.SlackBuild

The nvidia Proprietary Driver

If you want to use the nVidia proprietary drivers, you must not use nouveau, as the drivers interfere with each other. This can be prevented by removing nouveau, installing xf86-video-nouveau-blacklist from /extra, or blacklisting nouveau manually.

This part is entirely optional. Slackware 13.37 and above comes with xf86-video-nouveau, the open source nVidia graphics card drivers. If you are using this, you do not need the closed source proprietary nVidia drivers. However, if you wish to use the closed source drivers, then install the packages listed in this section before going on.

Some nvidia driver versions are incompatible with certain kernel versions. One example is nvidia's 319.32 driver and the 3.10.* kernel series. In order to use the official proprietary nvidia 319.32 driver with the 3.10.* kernel series, one had to apply this patch: http://sprunge.us/UaaH or use a newer version of the driver that does support the kernel version. You can also follow the SlackBuilds.org guideline when a newer version is out and the maintainer has not updated it.

1. Build and install: libvdpau (Now required to assist in building the newer nvidia-bumblebee packages)

# cd ../libvdpau
# ./libvdpau.Slackbuild
# upgradepkg --install-new libvdpau-*.t?z

2. Build and install: nvidia-bumblebee

# cd ../nvidia-bumblebee
# ./nvidia-bumblebee.SlackBuild
# upgradepkg --install-new nvidia-bumblebee-*.t?z
# COMPAT32=yes ./nvidia-bumblebee.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.

3. Build and install: nvidia-kernel

# cd ../nvidia-kernel
# ./nvidia-kernel.SlackBuild
# upgradepkg --install-new nvidia-kernel-*.t?z
# COMPAT32=yes ./nvidia-kernel.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.

Post-Installation

Excellent. Now we're ready to do some post-installation setup. The bumblebee package provided us with an rc.bumblebee script in /etc/rc.d where the other startup scripts are also located. Remember to make this script executable and, if you so desire, start it!

# chmod +x /etc/rc.d/rc.bumblebee
# /etc/rc.d/rc.bumblebee start

If you would like bumblebee to autostart with the system, you can add the following to /etc/rc.d/rc.local:

[ -x /etc/rc.d/rc.bumblebee ] && /etc/rc.d/rc.bumblebee start

You can even go a step further by having bumblebee stop with your system by adding the following lines to /etc/rc.d/rc.local_shutdown. You can create this file if it does not exist.

[ -x /etc/rc.d/rc.bumblebee ] && /etc/rc.d/rc.bumblebee stop

Done! Any program we want using the nVidia graphics card can be run with “optirun” or “primusrun” like this:

$ optirun glxspheres
$ primusrun glxspheres

Pretty easy, right? Well not for all I suppose. If you chose to use VirtualGL (optirun), some programs will not work directly like this. Some require optirun to run bash first like this:

$ optirun bash

Now we can execute the program directly without adding “optirun” at the beginning:

$ wine ~/.wine/drive_c/Program_Files/Starcraft\ 2/Starcraft\ 2.exe

Editing the Configuration Files

A few general /etc/bumblee/bumblebee.conf configuration edits (likely suited for all):

# If you added your user account to a different user group than "bumblebee" at the start, make sure to change the "ServerGroup=" line accordingly.
# Here we set it to "ImAllergicToBees":
ServerGroup=ImAllergicToBees
 
# Perhaps you don't like using Display :8 for X11. We can change that too, in this example we set it to 3:
VirtualDisplay=:3
 
# I want to specify my driver that bumblebee will use by default. Here we show nouveau, but you can easily replace it with "nvidia".
# For the rest of this small section, we'll be using nouveau for simplification.
Driver=nouveau
 
# Don't forget to add their respective lines as well.
KernelDriver=nouveau
Module=nouveau

FAQ That Google Might not Answer


1. Q: I upgraded or downgraded my kernel and now I get “Fatal: module bbswitch not found” and bumblebee doesn't work! What do I do?

A: bbswitch and nvidia-kernel are kernel modules that place themselves in /lib/modules/<SOME KERNEL VERSION> so if you upgraded your kernel, just rebuild your nvidia-kernel and bbswitch packages so that the new package will place itself into the newer /lib/modules/<KERNEL VERSION>.

2. Q: If I upgrade nvidia-kernel, will I have to upgrade nvidia-bumblebee (or vice versa) too?

A: No. Although they both use the same source files, they install very different things. The nvidia-kernel is just the kernel-module, and nvidia-bumblebee is the rest of the application.

3. Q: (Extension to #2) What if it's a new version of the nvidia proprietary driver?

A: Then in that case, then you should probably upgrade both nvidia-bumblebee and nvidia-kernel.

4. Q: What is this multilib/compat32 stuff and do I need it?

A: This isn't bumblebee-specific and depends on what you want. Read the multilib page for more details and if you will need/want it or not.

Specific Laptop Models and nVidia GPU's


Bumblebee has mixed results depending on the nVidia graphics card and driver. Some are better than others. I hope that in this section, if you have a configuration suggestion, post it in the discussion section to help those with the same graphics cards on their nVidia optimus setups (and the configuration will later be added to the article). Some of these settings may work for all laptops, some may not. We're taking precautions just in case. Because we don't know what little differences there might be between video cards, don't forget to mention your laptop model and the driver xorg.conf you're using.

This one change is suitable for those running a multilib system.

  • /etc/bumblebee/bumblebee.conf
# This is on a multilib system, so that is why /usr/lib64 AND /usr/lib are being used in LibraryPath:
LibraryPath=/usr/lib64/nvidia-bumblebee:/usr/lib/nvidia-bumblebee:/usr/lib64:/usr/lib
XorgModulePath=/usr/lib64/nvidia-bumblebee/xorg,/usr/lib64/xorg/modules

Sources


In Other Languages
Translations of this page?:
QR Code
QR Code howtos:hardware:nvidia_optimus (generated for current page)