{"id":643,"date":"2014-12-21T11:42:05","date_gmt":"2014-12-21T04:42:05","guid":{"rendered":"http:\/\/blog.trichev.com\/?p=643"},"modified":"2017-08-10T09:13:45","modified_gmt":"2017-08-10T02:13:45","slug":"lenovo-thinkpad-t420-nvidia-optimus-in-fedora-21","status":"publish","type":"post","link":"https:\/\/trichev.com\/blog\/2014\/12\/21\/lenovo-thinkpad-t420-nvidia-optimus-in-fedora-21\/","title":{"rendered":"Lenovo ThinkPad T420. NVIDIA Optimus in Fedora 21"},"content":{"rendered":"<p><strong>Install Dependencies<\/strong><\/p>\n<p>#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<\/p>\n<p>You also need to install VirtualGL. Download the latest version for your arch at the VirtualGL download page or use yum command<\/p>\n<p>#yum install VirtualGL <\/p>\n<p>If you want to run 32 bit apps on your 64 bit system, then also install:<\/p>\n<p>#yum install VirtualGL.i686 <\/p>\n<p><strong>Install Bumblebee<\/strong><\/p>\n<p>Install the Bumblebee yum repository<br \/>\nFedora 21<\/p>\n<p>$yum install http:\/\/install.linux.ncsu.edu\/pub\/yum\/itecs\/public\/bumblebee\/fedora21\/noarch\/bumblebee-release-1.2-1.noarch.rpm<\/p>\n<p>Install Bumblebee:<\/p>\n<p>$yum install bbswitch bumblebee<\/p>\n<p>Bumblebee with the NVIDIA proprietary drivers<\/p>\n<p>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:<\/p>\n<p>Install the bumblebee-nonfree repository:<br \/>\nFedora 21<\/p>\n<p>$yum install http:\/\/install.linux.ncsu.edu\/pub\/yum\/itecs\/public\/bumblebee-nonfree\/fedora21\/noarch\/bumblebee-nonfree-release-1.2-1.noarch.rpm<\/p>\n<p> For all versions<\/p>\n<p>Make sure you have glibc-devel installed because it is needed for bumblebee-nvidia to compile the driver<\/p>\n<p>sudo yum install glibc-devel<\/p>\n<p>Now install bumblebee-nvidia<\/p>\n<p>#yum -y install bumblebee-nvidia<\/p>\n<p>&#8220;bumblebee-nvidia&#8221; is both a rpm package and a shell script. The &#8220;bumblebee-nvidia&#8221; package contains the shell &#8220;wrapper&#8221; script, init scripts to run it at bootup, and a SELinux security policy, and lastly a copy of the NVidia Linux binary driver &#8220;blob&#8221; downloaded from NVidia&#8217;s UNIX drivers page. This is why the packages are so large compared to the bumblebee package.<\/p>\n<p>Reboot.<\/p>\n<p><strong>Testing Bumblebee<\/strong><\/p>\n<p>To verify you are now using the NVIDIA driver, run the glxgears demo (from mesa-demos):<\/p>\n<p>optirun glxgears -info | grep &#8220;GL_VENDOR&#8221;<\/p>\n<p>You should see some gears rotating. In the terminal you should see &#8220;GL_VENDOR = NVIDIA Corporation&#8221; or something similar.<br \/>\nPrimus<\/p>\n<p>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.<\/p>\n<p>Install primus:<\/p>\n<p>#yum -y install primus <\/p>\n<p>If you want to run 32 bit apps on your 64 bit system, then also install:<\/p>\n<p>#yum -y install primus.i686<\/p>\n<p><strong>Testing primus<\/strong><\/p>\n<p>Open up a terminal and run:<\/p>\n<p>PRIMUS_VERBOSE=2 optirun -b primus glxgears -info<\/p>\n<p>If primus is working properly, you should see &#8220;primus: profiling:&#8221; messages every so often in the terminal you ran it from.<br \/>\nHow to use Bumblebee<\/p>\n<p>General Usage:<\/p>\n<p>optirun [options]  [application-parameters]<\/p>\n<p>If you installed primus, then you can use the following command to take advantage of it:<\/p>\n<p>optirun -b primus  [application-parameters]<\/p>\n<p>Start Windows applications:<\/p>\n<p>optirun wine .exe<\/p>\n<p>with primus:<\/p>\n<p>optirun -b primus wine .exe<\/p>\n<p>By default, primus renders up to 60 fps. To render more frames per second:<\/p>\n<p>vblank_mode=0 optirun -b primus  [application-parameters]<\/p>\n<p>In practice this will probably only waste power, as most screens do not display more than 60 frames per second.<\/p>\n<p>You can always run &#8220;man optirun&#8221; for more information. <\/p>\n<p><strong>Optimus and Steam for Linux<\/strong><\/p>\n<p>To make a game run using the discrete GPU, use these simple steps:<br \/>\n1. Select a game &#8211; that you want to run using your discrete Nvidia card &#8211; from the Library page of the Steam client, right-click, and select Properties.<br \/>\n2. Click the SET LAUNCH OPTIONS&#8230; button and specify primusrun %command% for the command line.<br \/>\n3. Save your changes.This method allows you to pick when the discrete NVidia GPU should be used on a per-game basis.<\/p>\n<p>Links:<br \/>\n<a href=\"https:\/\/fedoraproject.org\/wiki\/Bumblebee\">https:\/\/fedoraproject.org\/wiki\/Bumblebee<\/a><br \/>\n<a href=\"https:\/\/wiki.archlinux.org\/index.php\/Bumblebee\">https:\/\/wiki.archlinux.org\/index.php\/Bumblebee<\/a><br \/>\n<a href=\"http:\/\/techies.ncsu.edu\/wiki\/bumblebee\">http:\/\/techies.ncsu.edu\/wiki\/bumblebee<\/a><br \/>\n<a href=\"http:\/\/bumblebee-project.org\/\">http:\/\/bumblebee-project.org\/<\/a><br \/>\n<a href=\"https:\/\/github.com\/Bumblebee-Project\/Bumblebee\/wiki\">https:\/\/github.com\/Bumblebee-Project\/Bumblebee\/wiki<\/a><br \/>\n<a href=\"http:\/\/ubuntuforums.org\/showthread.php?t=2059854\">http:\/\/ubuntuforums.org\/showthread.php?t=2059854<\/a><br \/>\n<a href=\"https:\/\/fedoraproject.org\/wiki\/How_to_debug_Xorg_problems\">https:\/\/fedoraproject.org\/wiki\/How_to_debug_Xorg_problems<\/a><br \/>\n<a href=\"https:\/\/wiki.archlinux.org\/index.php\/Lenovo_ThinkPad_T420#NVIDIA_Optimus\">https:\/\/wiki.archlinux.org\/index.php\/Lenovo_ThinkPad_T420#NVIDIA_Optimus<\/a><br \/>\n<a href=\"https:\/\/support.steampowered.com\/kb_article.php?ref=6316-GJKC-7437\">https:\/\/support.steampowered.com\/kb_article.php?ref=6316-GJKC-7437<\/a><br \/>\n<a href=\"https:\/\/cjenkins.wordpress.com\/2013\/01\/01\/steam-for-linux-on-optimus-enabled-computer-running-ubuntu-12-04-64bits\/\">https:\/\/cjenkins.wordpress.com\/2013\/01\/01\/steam-for-linux-on-optimus-enabled-computer-running-ubuntu-12-04-64bits\/<\/a><br \/>\n<a href=\"http:\/\/unix.stackexchange.com\/questions\/133921\/is-it-possible-to-run-steam-games-using-optirun\">http:\/\/unix.stackexchange.com\/questions\/133921\/is-it-possible-to-run-steam-games-using-optirun<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[231],"tags":[202,200,193,32,201,203,194,28,14,11],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/posts\/643"}],"collection":[{"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/comments?post=643"}],"version-history":[{"count":1,"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/posts\/643\/revisions"}],"predecessor-version":[{"id":644,"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/posts\/643\/revisions\/644"}],"wp:attachment":[{"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/media?parent=643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/categories?post=643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trichev.com\/blog\/wp-json\/wp\/v2\/tags?post=643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}