Do I need to install Bumblebee for Hybrid Graphics system to enable Optimus on Ubuntu 16.04?

Solution 1:

Currently, you have (at the best of my knowledge) three possibilities regarding Nvidia hybrid graphics (the so-called Optimus technology) under Linux:

  • Bumblebee. While this project might seem dead, it’s not (discloser: I’m part of the dev team). It has been slowly developing for a very long time, because we were all quite busy, but things have gone better recently, and we received help from new contributors. The 4.0 version is on track, it’s mostly bug fixes and the primus backend becoming the default (most people won’t notice since they were already using it). Bumblebee allows you to run your desktop and display on the integrated Intel chip, while running selected applications on the discrete Nvidia card. It can use either nouveau or nvidia driver (given that they support your card, which they should both do), and relies on bbswitch for power management (with the option of using vga_switcheroo if using nouveau). On the performance side, because of how it works, Bumblebee is PCIe bottlenecked, which means you can not achieve very high framerates (which is not really usefull anyway) but also that you can never reach the full power of your dedicated Nvidia card. In case some of the display outputs on your laptop are wired to the Nvidia chip (often the case of HDMI on Lenovo laptop), Bumblebee allows you to use them, but it requires a bit of configuration, is probably far less than ideal and above all not tested since no any of Bumblebee devs own an affected laptop. Otherwise, Bumblebee works with either DRI2 or DRI3.
  • PRIME. This is the proper solution for this technology, and is implemented at the right level: drivers, kernel, Xorg… PRIME allows you the same setup as Bumblebee, however, due to legal concerns, only nouveau is supported. Outside of that, it has also some issues with tearing because of changes needed in the i915 driver. Also, nouveau still has a lot of issues regarding performances, so until it gets proper reclocking, you might have less perfs than in the Bumblebee + nvidia setup (Bumblebee + nouveau suffers from the same issue obviously). PRIME does not rely on bbswitch for power management, but rather use nouveau/kernel integrated one. PRIME also allows you to use outputs wired to the Nvidia chip quite transparently AFAIK. When running on DRI2, it requires a bit of configuration (depending on whether you also have Bumblebee/bbswitch installed, the exact amount may vary), but nothing outstanding. VDPAU is supported too in this mode (but only with nouveau driver again). When running on DRI3, it’s very seemless to use (so much that Bumblebee will probably gain support for this mode in the next release). However, you don’t get VDPAU support, and apparently no Nvidia outputs support either.
  • Reverse PRIME. Here, the idea is to use the Nvidia card for everything including the desktop, and only use the Intel chip as an output sink for the laptop display. This is supported by both nouveau (with the same performances issues as above) and nvidia (with the dedicated nvidia-prime tool under Ubuntu for instance). This means you don’t get powersaving at all (and get increased power consumption at all stages), but as with PRIME you can easily and fully utilize any display output. In this mode, you get the best of your dedicated card when using the nvidia driver. This is also the only configuration where you can get VDPAU working on the Nvidia chip using the nvidia driver. However, it has also some issues with tearing because of changes needed in the i915 driver. This mode only works with DRI2. In fact, this is for the same reason as why you can’t use outputs in PRIME+DRI3: Reverse PRIME is in fact the name of the support for using another card outputs (whether it’s Intel ones while running on Nvidia here or Nvidia ones when running on Intel above), and that currently does not work under DRI3.

Note that things like CUDA or OpenCL do not require any of these tools, just a bit of configuration, but Bumblebee as a mode to use them easily while still getting its other advantages.

PRIME and Bumblebee can cohabit when using DRI3, but under DRI2 or switching to Reverse PRIME requires a switch of configuration files and restarting the X server. So, depending on your needs, this is what I would advice:

  1. If you don’t care about performances, but care about ease of utilisation (for external outputs mainly — if affected) and FLOSS, go for PRIME.
  2. If you care a bit more on performances but often use your laptop in battery mode and don’t want to restart your X server all the time, go for Bumblebee.
  3. If you care about performances and mostly use your laptop while plugged on AC (and don’t care about some extra W saving), take a look at Reverse PRIME using nvidia (you can use nvidia-prime to switch to Intel only mode when running occasionally on battery, but I’m not sure if the Nvidia card is turned off in this setup).

Solution 2:

Ubuntu 16.04 of course supports hybrid graphics solutions, especially notebooks that have intel graphics and NVIDIA graphics with Optimus support. Do NOT install bumblebee, it is not under development anymore, the latest version is from April 2013. The solution to switch between the two graphics today is nvidia-prime, which is available in the official Ubuntu repositories. Most important to get everything working properly is the way the drivers are getting installed. Here you find the instructions to install the drivers with a high chance that everything works properly :

Install NVIDIA drivers

Solution 3:

A reason to install bumblebee instead of nvidia-prime is that with bumblebee you can switch easier between both GPUs. With nvidia-prime you can only select a single GPU for an X session. That means that if you want to switch GPU, the X session has to be restarted. With bumblebee, it is not necessary to restart the X server.
This blog contains installation instructions for bumblebee on 16.04. The comments section also discusses the reason to install bumblebee instead of nvidia-prime in more detail.

Solution 4:

PRIME works perfectly well with NVidia proprietary drivers now(mine is 367), so my guess is, even though @Archange's answer is very extensive and detailed, PRIME has no performance implications any longer, and is probably the best option in terms of performance now.

@Archange, or did you mean that with nouveau it can really happen automatically, Windows-style?