[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:hardware:nvidia_optimus [2015/01/31 17:21 (UTC)] – Added temporary announcement about newer nvidia makefiles tommychowtos:hardware:nvidia_optimus [2020/12/24 22:57 (UTC)] (current) – Add section on new official Optimus support with proprietary driver; update intro and sources accordingly poprocks
Line 1: Line 1:
 <!-- Reviewed 20130114 by hazel --> <!-- Reviewed 20130114 by hazel -->
 ====== Nvidia Optimus ====== ====== Nvidia Optimus ======
-<note warning> 
-**Temporary Announcement:** Some newer versions of the Nvidia drivers had changed their Makefiles and may have installed some files into /usr/local/lib. You may want to remove those (and if you do, it must be done manually). For more information, check out [[http://www.linuxquestions.org/questions/slackware-14/new-nvidia-settings-broken-4175532224/|this thread]].</note> 
-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 alonenVidia developers do assist the Bumblebee project by fixing bugs in the closed source proprietary drivers that Bumblebee developers cannot touch.+Some laptops 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, until the release of version 435 in 2019, the closed-source proprietary drivers have not offered a means for adjusting or switching between the two. 
 + 
 +Historically, there has been an open-source project called Bumblebee that has aimed to fix this problem. Bumblebee has not been maintained for some time; however, it may still be of value for users with older hardware that is no longer supported by version 435 or greater of the proprietary driverMoreover, as the official Optimus support in the proprietary driver requires xorg-server 1.20.7 or greater, Slackware Current is required as of the time of writing. Thus, we will be providing instructions for both the Bumblebee method and the newer, official method provided by the nVidia proprietary driver.
  
 <note> <note>
Line 15: Line 14:
 </note> </note>
  
-==== X11 and Other Programs without Bumblebee ==== +==== Note: The Intel Driver is Often Sufficient ====
-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.+You do //not// need to use Optimus via Bumblebee or the nvidia proprietary driver in order to use modern applications and desktop environments under X11. The Intel graphics often provide sufficient 2D and 3D acceleration for those programs to work smoothly without having to use the nVidia GPU. 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 ==== ==== Installing Bumblebee ====
Line 34: Line 32:
 Alternatively you can download the script and run it as root on your system directly. Alternatively you can download the script and run it as root on your system directly.
  
-This script detects multilib, creates the necessary group, adds users and applies the necessary /etc/rc.d/rc.local entries.+This script detects multilib, creates the necessary group, adds users and applies the necessary /etc/rc.d/rc.local entries and also comes with a stable option which can be used by passing this instead: 
 + 
 +<code> 
 +curl https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh | STABLE=yes sh 
 +</code>
  
 It also uses upgradepkg's %%--%%reinstall %%--%%install-new features for use after kernel upgrades. It also uses upgradepkg's %%--%%reinstall %%--%%install-new features for use after kernel upgrades.
Line 185: Line 187:
 # ./nvidia-kernel.SlackBuild # ./nvidia-kernel.SlackBuild
 # upgradepkg --install-new nvidia-kernel-*.t?z # upgradepkg --install-new nvidia-kernel-*.t?z
-</code> 
-<code> 
-# COMPAT32=yes ./nvidia-kernel.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system. 
 </code> </code>
 ==== Post-Installation ==== ==== Post-Installation ====
Line 238: Line 237:
 Module=nouveau Module=nouveau
 </code> </code>
 +
 +==== Official Optimus Support with the nVidia Proprietary Driver ====
 +----
 +=== Note ===
 +
 +This will //not// work with Slackware 14.2 or any stable version of Slackware, as at the time of writing. Slackware Current is required.
 +
 +=== Dependencies/Requirements ===
 +
 +**//From main -current tree://**
 +
 +  * ''xorg-server >= 1.20.7''
 +
 +Do not try this with older versions - it will //not// work. Certain specific git commits are required to have been added to xorg-server; see the official nVidia documentation linked to in the [[#Sources]] section. These commits are only present in versions >= 1.20.7.
 +
 +  * ''xf86-video-nouveau-blacklist >= 1.0 or xf86-video-nouveau >= "blacklist"''
 +
 +Patrick Volkerding recently changed 'blacklist' from being the version number which would trample over the actual package containing the module, to 'blacklist' being part of the package-name with '1.0' being the version number. Either one is fine; just be aware of this.
 +
 +The one with the package-name 'xf86-video-nouveau-blacklist' will coexist with xf86-video-nouveau, which is fine. The important thing is that ''/etc/modprobe.d/BLACKLIST-nouveau.conf'' be present on your system, which will ensure that the nouveau module is properly blacklisted.  
 +
 +**//From SlackBuilds.org://**
 +
 +  * ''nvidia-kernel >= 435.17''
 +
 +Build normally. I got a gcc mismatch error as I am using a kernel that is quite old. I was able to override it successfully by adding the environment variable spouted out by the nvidia installer during the build process when it failed the first time. YMMV. For best results, build nvidia-kernel using the same version of gcc that was used to build the kernel itself.
 +
 +  * ''nvidia-driver >= 435.17''
 +
 +Be sure to build with ''CURRENT="yes"'' and optionally with ''COMPAT32="yes"'' in the custom build options of the SlackBuild. The nvidia-switch scripts are //not// required with -current as libglvnd is now included in mainline -current.
 +
 +=== Next Steps ===
 +
 +Once you have the packages listed above installed, I would recommend rebooting.  Is this strictly necessary? Probably not, but in my experience when you start playing around with kernel modules involving graphics drivers, it is a best practice to reboot, because it is easy to //think// you have a working setup only to find that it didn't survive a reboot (and chances are, by then you will have forgotten what you did to make it work).
 +
 +I would also recommend changing your runlevel to 3 if it is currently 4.
 +
 +Once you have rebooted into runlevel 3, ensure that the ''nvidia_drm'' module has been successfully loaded:
 +
 +<code>
 +$ lsmod |grep nvidia_drm
 +</code>
 +
 +As root, add the following to ''/etc/X11/xorg.conf.d/21-LAR-nvidia-screens.conf'' (or any filename you would like):
 +
 +<code>
 +# cat << EOF > /etc/X11/xorg.conf.d/21-LAR-nvidia-screens.conf
 +Section "ServerLayout"
 +  Identifier "layout"
 +  Option "AllowNVIDIAGPUScreens"
 +  Screen 0 "iGPU"
 +EndSection
 +
 +Section "Device"
 +  Identifier "iGPU"
 +  Driver "modesetting"
 +EndSection
 +
 +Section "Screen"
 +  Identifier "iGPU"
 +  Device "iGPU"
 +EndSection
 +
 +Section "Device"
 +  Identifier "nvidia"
 +  Driver "nvidia"
 +EndSection
 +EOF
 +</code>
 +
 +Note that the official nVidia documentation seems to indicate you only need the following:
 +
 +<code>
 +Section "ServerLayout"
 +  Identifier "layout"
 +  Option "AllowNVIDIAGPUScreens"
 +EndSection
 +</code>
 +
 +However, for me this has //not// worked. YMMV. It is possible that, in the future, a more minimal configuration will in fact work. It is suggested that this be monitored at this time. As is often the case with Xorg configuration, the less that is manually configured, and the more that is left to be auto-configured, the better.
 +
 +Next, launch your xserver.
 +
 +If GPU screen creation was successful, the log file ''/var/log/Xorg.0.log'' should contain lines with ''NVIDIA(G0)'', and querying the RandR providers with ''xrandr --listproviders'' should display a provider named ''NVIDIA-G0'' (for "NVIDIA GPU screen 0"). 
 +
 +If that is the case, the following command:
 +
 +<code>
 +$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo |grep 'OpenGL vendor'
 +</code>
 +
 +should display:
 +
 +<code>
 +OpenGL vendor string: NVIDIA Corporation
 +</code>
 +
 +and the following command:
 +
 +<code>
 +$ glxinfo |grep 'OpenGL vendor'
 +</code>
 +
 +should display your integrated GPU's vendor as opposed to NVIDIA (e.g., Intel).
 +
 +You can then test using something like:
 +
 +<code>
 +$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
 +</code>
 +
 +You can now launch any program using your Nvidia dGPU by utilizing those two environment variables and prepending them to the program command you are running. I would refrain from using the GUI tools that come with nvidia-driver.  I have no idea to what extent they will trample all over your /etc/ directory, and I have no idea if they actually work to get the above working, as this setup is still fairly bleeding-edge at this point.
 +
 +As per usual, YMMV.
 +
 +=== Known Issues ===
 +
 +BrokenCog on IRC has reported that this setup may not work with external monitors.
 +
 +Again, as indicated above, we are working as a community to find out what the abolute minimum manual xorg.conf settings are in order to just get Optimus working. As per usual with xorg settings nowadays, the less you can get away with manually specifying, the better. The xorg server works best when it can just do its own autoconfig to the largest extent possible, in my experience.
 +
 +Do //not// try to run applications by setting ''DRI_PRIME=1'' by utilizing this setup. It may cause your applications to crash or (as was the case for me) to dead-lock your X server.
  
 ==== FAQ That Google Might not Answer ==== ==== FAQ That Google Might not Answer ====
Line 275: Line 396:
   * New SlackBuilds: https://github.com/whitewolf1776/Bumblebee-SlackBuilds   * New SlackBuilds: https://github.com/whitewolf1776/Bumblebee-SlackBuilds
   * Originally written by [[wiki:user:tommyc | TommyC]]   * Originally written by [[wiki:user:tommyc | TommyC]]
 +  * Section on official Optimus support by the nvidia proprietary driver contributed by [[wiki:user:poprocks | Poprocks]], based partly on official documentation from nVidia: [[https://download.nvidia.com/XFree86/Linux-x86_64/450.80.02/README/primerenderoffload.html]] 
  
 <!-- Please do not modify anything below, except adding new tags.--> <!-- Please do not modify anything below, except adding new tags.-->
 {{tag>howtos software hardware nvidia author_tommyc}} {{tag>howtos software hardware nvidia author_tommyc}}
 +
 howtos:hardware:nvidia_optimus ()