**Pre-amble:**I am a long-time SUSE (in all its flavours) user and for the first time now need to install it on laptops with dual Intel/NVIDIA GPUs, so am trying to understand the Optimus issue. Whereas there is lots of information available, there is no overall description of this topic (that I could find). Current articles only deal with small parts of the problem; this is a constantly-changing situation so a lot of the advice is either out-of-date or experimental and unproven; some reports bias facts with dogma; a lot of the commentary is about other distros; many proposals quickly dive into roll-your-own low-level changes to system config files, scripts, etc, rather than aiming for a packaged distro-supported solution. I’m more than technically competent to do all the low-level config - however on this occasion I really want something that “just works” so I can devote my time to using SUSE to solve other problems, rather than solving SUSE/NVIDIA problems.
To that end, I’ve tried to compile a purely factual list of the main options, their limitations, and what’s required to make them work with openSUSE 13.2. This started for my own use, but judging by the number of unanswered questions and confusion I discovered across the ‘net while researching it, I thought I’d post here for others’ benefit too. It’s a mixture of statements (or rather at this stage postulates) and questions. I would really appreciate further input from SUSE experts to answer the questions and correct any errors in the statements. I will update this post with new information and corrections so it can hopefully be a one-stop useful reference on the “big picture” around Optimus. Or if such a comprehensive big-picture does already exist, please point me at it (my extensive searches couldn’t find one) and I’ll delete this one. I include links to reference material and other articles to support the information herein. Please suggest more authoritative/correct links if there are better sources.
Quick recap for people new to Optimus: Optimus is NVIDIA’s scheme for supporting two GPUs on a computer, connected to the same screen(s) (typically laptop or other battery-powered device with embedded (eg)Intel GPU plus discrete NVIDIA GPU). The idea is that one (the embedded) GPU, with lower power consumption and consequently lower graphics capabilities, can be used to save power when needed (eg when running on batteries); the other GPU, with better graphics capabilities but higher power consumption, can be used for applications that need that better graphics support. The changeover could be automatic (done by the system based on config settings) or manually by the user, maybe per-session or per-application. (NB setups with two GPUs controlling separate screens are a bit different; obviously for a multi-monitor setup in that case, both GPUs are used simultaneously. X usually deals with that ok and xrandr can I believe be used for config. Such setups and config are not the topic of this document).
The problem with all this for Linux is that Optimus is proprietary technology, the details of which NVIDIA has not made easily available. So open-source Linux drivers are being actively developed but do not yet fully support it, and NVIDIA’s own drivers for Linux only partially implement it (as they focus the bulk of their effort on the larger and more lucrative Windows market). There is a confusing mixture of partial and manual solutions for graphics support in Linux on these dual GPU computers with Optimus. The following tries to summarise the main options currently available for openSUSE 13.2, as of Nov 2014. In the following I use “simple install” to mean a one-click install, yast/zypper standard repository installation, etc. I use “manual config” if an option requires editing system config files, script, etc. The goal obviously is that this should all “just work” with “simple installs” only, no “manual config” being required (at least not just to get a standard system running normally).
1. By default, the openSUSE 13.2 installation will install drivers (eg MESA) for the embedded GPU. The nouveau open-source drive will be installed for the NVIDIA GPU but won’t do anything. [Is that correct?] This should give out-of-the-box a fully-working system using only the embedded GPU. Without further config (eg see (3) below) the NVIDIA GPU will not be used. [Is that correct?] I think the NVIDIA GPU will still be powered-up though, wasting system power. I believe some manual config to blacklist the nouveau driver solves this [does it? is the nouveau driver still needed for anything else] This of course may be a perfect solution for non-heavy-graphics users, who can stop reading here and forget they ever heard of Optimus (their only downside is a few hundred grammes of dead-weight in their computer from a component (NVIDIA GPU) they won’t use, and a few dollars wasted paying for that component).
For those who do want to use the NVIDIA GPU, there seem currently to be three main options, as follows. Usually, only one of these should be installed/used at a time. NB The ordering below of the options is not meant to imply any of these are better than any other! Note in particular which options provide per-session GPU switching versus per-application switching.
2. Install the proprietary NVIDIA drivers. This is in theory a simple install but may require manual config depending on system. Note by default this install overwrites [does it still do this for the latest driver release?] some existing files making the drivers for the embedded GPU then unusable; manual config would be needed to fix this to revert to the embedded GPU. A command-line switch to the installer prevents this overwriting [but does that also then prevent the NVIDIA GPU using OpenGL? - which would seem to defeat the purpose of installing this driver]. With the proprietary NVIDIA driver, the NVIDIA GPU will be used by default. An NVIDIA utility, nvidia-settings, provides per-session GPU switching (eg need to logout/login to restart the X server to complete the change), not per-application switching. It’s not clear (at least not to me) whether this really is fully switching between GPUs, powering down the NVIDIA GPU when the embedded GPU is selected, or whether it’s some smoke-and-mirrors. *[how can nvidia-settings switch to the embedded GPU if the NVIDIA install has overwritten the OpenGL files?]
Note there is a newer NVIDIA driver than that linked to by the above SDB page; reasons for/against installating this one?
(NB: the “nvidia-prime” package for Ubuntu just does (it seems) what’s above, using the proprietary NVIDIA drivers. It’s nice they’ve automated that, I mention it here as I’ve seen some confusion that people think this means Ubuntu now has full dynamic (per-application) GPU switching built-in, but (it seems) it’s actually per-session [which is it?])
**3. Install the nouveau open-source driver for the NVIDIA GPU **(if it wasn’t installed as part of the original OS install). With nouveau, one can use ‘PRIME’ to select which GPU to use per-program (via the command line to launch the program). This I believe needs a certain minimum version of the Linux kernel (to which the necessary Optimus support was added some time ago) but no other installation is required; I don’t know the version number but I believe openSUSE 13.2 has a new-enough kernel version to include this. *[Is that correct?] [The link below is for ArchLinux; does the same thing work in openSUSE 13.2?] *If the NVIDIA GPU is used for a program, via PRIME, does the NVIDIA GPU power-down when that program exits? Note the only apparent downside to nouveau (compared to the proprietary NVIDIA driver) is performance concerns (mainly due to non-availability of the NVIDIA specs, not because nouveau is bad code!); many of these have now been fixed and I believe others are being fixed, so these concerns are mostly now historic *[is that correct?]
**4. Install bumblebee and the bumblebee version of the NVIDIA driver **(nb this is the NVIDIA proprietary driver, just installed to a different location so as not to overwrite key files needed by the existing drivers - cf option 2 above). After this install, the embedded GPU is still the default, and the NVIDIA GPU is powered-down by default *[is it?]. *This setup provides per-application GPU switching via a command-line incantation. * [If the NVIDIA GPU is used for a program, does it power-down when that program exits?] *Although the SDB link below document a simple install, other reports suggest manual config may also be required. Note the only apparent downside to bumblebee is that because it uses a software solution to bridge the two GPUs, it is a bit slower than just using the NVIDIA driver exclusively with the NVIDIA GPU (option 2 above) [is that correct?]. But ‘slower’ is almost certainly still plenty fast enough; see the performance figures in the third link below.
(This page is a bit old but helps explain the difference between optirun and primusrun: http://www.webupd8.org/2012/11/primus-better-performance-and-less.html)
Other Things To Consider:
For options 2, 3 and 4, the hardware must allow the NVIDIA GPU to use the embedded GPU as a display sink (so that graphics rendered by the NVIDIA GPU can actually be seen on screens physically connected to the embedded GPU), and/or the NVIDIA GPU must have its own connection to the physical display screens. This should usually, if not always, be the case, otherwise it defeats the point of Optimus’s dynamic switching premise, even for Windows - I mention it for completeness. This may require manual config. Some of the above links cover this.
Also for the bumblebee and nouveau/PRIME options, the command-line incantations to run specific programs with the NVIDIA GPU can be easily embedded into the launch commands / shortcuts for those programs, rather than needing to do them manually each time. This makes sense if there are particular programs that the user wants always to use the NVIDIA GPU - but doesn’t help if one wants the choice of GPU to be based on (eg) whether the computer is running on mains power or batteries. [What’s the best way to do that? Is there system config to say, eg “if running on mains power, use NVIDIA for such-n-such programs, but if running on batteries use embedded adapter for everything.” ? I suppose one could have a launch script that tests for the current power source and invokes different commands as appropriate?]
For options 1, 3 and 4 above, where the embedded GPU is the default, the GUI desktop uses that default embedded GPU. To have the desktop environment use the NVIDIA GPU in this situation requires manual configuration, for which there are several suggestions but no authoritative supported method (that I can find). Also in what situations would it even be necessary/useful to use the NVIDIA GPU for the desktop?
Finally: one of the key points of schemes like Optimus is to do away with hardwired (eg BIOS) manual settings for selecting GPU. However some computers do have BIOS settings to turn one or other GPUs on or off, and/or select which is the primary GPU. It’s not clear how that affects any of the above. For example, is it possible to setup the system to automatically just use whichever GPU it sees at boot-time (so the user could select in the BIOS per-boot which GUI to use)? Related to this, it does seem possible to software-enable (rather than BIOS setting) one or other GPU at boot-time.
Other related/useful links:
Suggested config for anyone who wants/needs to have both the NVIDIA way (option 2 above) and bumblebee on one system. Not sure this is a great idea, including link for reference.
Although the following describes setup for ArchLinux, it also has info on the NVIDIA vs nouveau vs Bumblebee scenarios.