Lenovo ThinkPad T420. NVIDIA Optimus in Fedora 21

Install Dependencies

#yum install -y libbsd-devel libbsd glibc-devel libX11-devel help2man autoconf git tar glib2 glib2-devel kernel-devel kernel-headers automake gcc gtk2-devel

You also need to install VirtualGL. Download the latest version for your arch at the VirtualGL download page or use yum command

#yum install VirtualGL

If you want to run 32 bit apps on your 64 bit system, then also install:

#yum install VirtualGL.i686

Install Bumblebee

Install the Bumblebee yum repository
Fedora 21

$yum install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora21/noarch/bumblebee-release-1.2-1.noarch.rpm

Install Bumblebee:

$yum install bbswitch bumblebee

Bumblebee with the NVIDIA proprietary drivers

The previous commands install bumbleblee with the nouveau drivers. If you want to install bumblebee with the NVIDIA proprietary drivers you must also follow these instructions:

Install the bumblebee-nonfree repository:
Fedora 21

$yum install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora21/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm

For all versions

Make sure you have glibc-devel installed because it is needed for bumblebee-nvidia to compile the driver

sudo yum install glibc-devel

Now install bumblebee-nvidia

#yum -y install bumblebee-nvidia

“bumblebee-nvidia” is both a rpm package and a shell script. The “bumblebee-nvidia” package contains the shell “wrapper” script, init scripts to run it at bootup, and a SELinux security policy, and lastly a copy of the NVidia Linux binary driver “blob” downloaded from NVidia’s UNIX drivers page. This is why the packages are so large compared to the bumblebee package.

Reboot.

Testing Bumblebee

To verify you are now using the NVIDIA driver, run the glxgears demo (from mesa-demos):

optirun glxgears -info | grep “GL_VENDOR”

You should see some gears rotating. In the terminal you should see “GL_VENDOR = NVIDIA Corporation” or something similar.
Primus

For speed imrovements you can use primus. Primus is a shared library that provides OpenGL and GLX APIs and implements low-overhead local-only client-side OpenGL offloading via GLX forking, similar to VirtualGL. It intercepts GLX calls and redirects GL rendering to a secondary X display, presumably driven by a faster GPU. On swapping buffers, rendered contents are read back using a PBO and copied onto the drawable it was supposed to be rendered on in the first place. Currently primus requires the NVIDIA proprietary drivers.

Install primus:

#yum -y install primus

If you want to run 32 bit apps on your 64 bit system, then also install:

#yum -y install primus.i686

Testing primus

Open up a terminal and run:

PRIMUS_VERBOSE=2 optirun -b primus glxgears -info

If primus is working properly, you should see “primus: profiling:” messages every so often in the terminal you ran it from.
How to use Bumblebee

General Usage:

optirun [options] [application-parameters]

If you installed primus, then you can use the following command to take advantage of it:

optirun -b primus [application-parameters]

Start Windows applications:

optirun wine .exe

with primus:

optirun -b primus wine .exe

By default, primus renders up to 60 fps. To render more frames per second:

vblank_mode=0 optirun -b primus [application-parameters]

In practice this will probably only waste power, as most screens do not display more than 60 frames per second.

You can always run “man optirun” for more information.

Optimus and Steam for Linux

To make a game run using the discrete GPU, use these simple steps:
1. Select a game – that you want to run using your discrete Nvidia card – from the Library page of the Steam client, right-click, and select Properties.
2. Click the SET LAUNCH OPTIONS… button and specify primusrun %command% for the command line.
3. Save your changes.This method allows you to pick when the discrete NVidia GPU should be used on a per-game basis.

Links:
https://fedoraproject.org/wiki/Bumblebee
https://wiki.archlinux.org/index.php/Bumblebee
http://techies.ncsu.edu/wiki/bumblebee
http://bumblebee-project.org/
https://github.com/Bumblebee-Project/Bumblebee/wiki
http://ubuntuforums.org/showthread.php?t=2059854
https://fedoraproject.org/wiki/How_to_debug_Xorg_problems
https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_T420#NVIDIA_Optimus
https://support.steampowered.com/kb_article.php?ref=6316-GJKC-7437
https://cjenkins.wordpress.com/2013/01/01/steam-for-linux-on-optimus-enabled-computer-running-ubuntu-12-04-64bits/
http://unix.stackexchange.com/questions/133921/is-it-possible-to-run-steam-games-using-optirun

Leave a comment

You must be logged in to post a comment.