The best Linux desktop environment setup for hybrid Intel+Nvidia in 2020?

I’m hoping someone with some experience in this can chime in. I am new to GPU switching.

I’m curious what you think is the best (in terms of performance, GPU switching ease, stability, and as bonus but not necessary battery saving) desktop environment and driver setup in order to be able to toggle (automatically or not) between GPUs.

There’s a bunch of material out there, but they can be dated, so I’m not always sure if something I find is still relevant (or if it is but there’s something that’s actually better).

I have an HP Zbook x360 G5 convertible laptop, with currently this setup which gives me a buttery-smooth Gnome experience, but with no GPU switching:

[trusktr@manjattan ~]$ inxi -G
Graphics:
  Device-1: NVIDIA GP107GLM [Quadro P2000 Mobile] driver: nvidia v: 440.64 
  Display: x11 server: X.org 1.20.7 driver: nvidia 
  resolution: <xdpyinfo missing> 
  OpenGL: renderer: Quadro P2000/PCIe/SSE2 v: 4.6.0 NVIDIA 440.64 

I have Gnome’s Wayland support enabled. I’m hoping to be able to use Wayland, but from the material I found all the GPU switching stuff seems to be aimed at Xorg (which makes sense as it is much older).

From what I’ve read (again maybe dated) Gnome and KDE are the only desktop envs to add EGLStream support, for Wayland, but if I need to Xorg instead of Wayland for GPU switching then maybe that doesn’t matter.

I don’t mind having to restart my login session to switch GPUs. Most of the time I don’t need the dGPU. I am okay restarting the login session to get into gaming/graphics mode, and switching back otherwise.

In your opinion, what’s the latest and best way (in terms of both hardware and software) to use GPU switching while having the most operational and stable DE experience in Linux?

I just want to note that things can be confusing for a newcomer in this area.

As a non-exhaustive example, there seem to be just many options and routes to try, and it isn’t clear which route is best for my hardware:

Searching for packages related one approach leads to multiple options:

[trusktr@manjattan ~]$ pacman -Ss bumblebee
community/bumblebee 3.2.1-22
    NVIDIA Optimus support for Linux through Primus/VirtualGL
community/primus 20151110-8
    Faster OpenGL offloading for Bumblebee
community/primus_vk 1.4-1
    Nvidia Vulkan offloading for Bumblebee
multilib/lib32-primus 20151110-4
    Faster OpenGL offloading for Bumblebee (32-bit)
multilib/lib32-primus_vk 1.4-1
    Nvidia Vulkan offloading for Bumblebee

At some point I stumbled on optirun and primusrun. Are those meant to be used exclusively with Bumblebee, or can optirun and primusrun work with optimus-manager (without bumblebee) when optimus-manager is in hybrid mode? Or is there something else for optimus-manager hybrid mode?

Etc.

There’s various pieces floating around without one big clear picture, at least based on all the resources that I’ve discovered so far.

If I do find one resource that make the picture more clear, I’ll definitely post it, but I haven’t found one yet (maybe the jigsaw needs to be put together).

Whoops! I was mistaken about my laptop, I think it only has an Nvidia GPU with no Intel GPU, so it isn’t hybrid. Well, hopefully an answer here may still help someone else.

EDIT: Oh wait, I do have hybrid graphics! I just needed to enable the option in BIOS. I have Intel UHD Graphics 630 + Nvidia Quadro P2000 Mobile. Sweeeet!

It depends.
Legacy gpu? External monitors?
bumblebee is outdated, primusrun doesn’t work anymore with recent drivers, only with legacy drivers.
On modern gpus/drivers, PRIME offload is the way to go. https://download.nvidia.com/XFree86/Linux-x86_64/440.64/README/primerenderoffload.html
Unless you want to use external monitors and all external connectors are wired to the nvidia gpu, then you have to use PRIME output.
Wayland is useless so far since the nvidia driver doesn’t support gpu accel in XWayland.

Hello @generix, it turns out I have Intel UHD Graphics 630 + Nvidia Quadro P2000 Mobile GP107GLM (I needed to enable the hybrid mode in BIOS, otherwise it was running on Nvidia only).

When I enable Dedicated mode in BIOS (so that I have only Nvidia enabled), I use the video-nvidia-440xx driver in Manjaro Linux. It is buttery smooth! :D

While on Hybrid mode in BIOS, Manjaro sets up the hybrid driver, video-hybrid-intel-nvidia-440xx-prime. In Hybrid mode, the Gnome Desktop graphics are rather clunky (I suppose running on the Intel GPU).

Manjaro gives me the command prime-run, and I can verify that things are buttery smooth when I run the that way (compared to when I don’t run them with prime-run).

I think the Intel GPU is running slower than it should, but that’s another topic I think.

The laptop has an HDMI port and two USB-C/Thunderbolt ports. I’m don’t know what this means though.

Ah, interesting. I am running Gnome in Wayland mode. Is the limitation you mention for non-Gnome Wayland environments (using GBM), or does it also apply to Gnome which uses EGLStreams? (I don’t know the technical differences between GBM and EGLStreams, but I’ve read Gnome and KDE are the only environments with EGLStream support).


Now that I’ve enabled Hybrid mode in BIOS and configured allowed Manjaro to configure the drivers, this is what I see with inxi:

$ inxi -G
Graphics:
  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
  Device-2: NVIDIA GP107GLM [Quadro P2000 Mobile] driver: nvidia v: 440.64 
  Display: x11 server: X.org 1.20.8 driver: modesetting,nvidia 
  unloaded: intel,nouveau resolution: <xdpyinfo missing> 
  OpenGL: renderer: Mesa DRI Intel UHD Graphics 630 (Coffeelake 3x8 GT2) 
  v: 4.6 Mesa 19.3.5 

I see Display: x11 server: X.org, but I guess it says that because it is tricked by XWayland, right?

Wait, so if I was able to run prime-run application and see a big difference, while I’ve set Gnome to using Wayland (at least, I turned that option on in Manjaro settings), does that mean that it does work in Wayland (assuming Wayland is enabled as the Manjaro UI tells me)?

If prime-run has any effect, I’d say you’re using Xorg, not Wayland, Run
xrandr
and it tells you either “Screen 0” or “XWAYLAND”. Xwayland not having gpu accel with the proprietary driver is independent from using GBM or eglstreams.
You can also check if you’re running on the nvidia or the intel gpu by running
glxinfo |grep vendor
If it returns “NVidia Corporation”, PRIME output is enabled, everything is running on the nvidia gpu, you don’t need prime-run.
If prime output is enabled, Gnome will be clunky due to a mutter bug, needs workaround, see: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1202#note_524334
Due to this bug, it’s not as smooth and fast as on discrete nvidia.
Edit: fixed typo in command

I see

glxinfo | grep vendor
server glx vendor string: SGI
client glx vendor string: Mesa Project and SGI
OpenGL vendor string: Intel Open Source Technology Center

so I’m on Intel for the desktop.

I tried prime-run firefox and in that case WebGL doesn’t work, but it does work in prime-run chromium. Well I guess that’s a separate issue.

I tried turning on Manjaro’s setting “Wayland session”, but when I restart and run xrandr, I see “Screen 0”, and the $XDG_SESSION_TYPE env var contains x11.

I see mine says Intel/Mesa. I’m curious though, can I specify desktop to run on Nvidia, but for apps to still use Intel unless I run the with prime-run?

Thanks for pointing out that Mutter issue. I’ll keep an eye on that. I am not experience 5-second lag though. Just the framerate is a little slower, with small inconsistencies (it’s just not perfectly smooth like when on Nvidia).

Mainly, I’d like to see if I can make the desktop animations smooth, but still save as much battery as possible. On Chromebook and Windows PCs with only Intel cards, all the UI animations are always smooth, and even many games are smooth. Maybe it is the Mutter issue though, just not 5 second lag in my case.

So this means X11 on intel, nvidia render offload enabled. So that bug shouldn’t affect you.
I can only state that Gnome 3.36 is absolutely fast and smooth on my old HD4600 mobile graphics.
Rendering the desktop on nvidia, applications on intel is only working in theory but in practice (if that were to work at all), that would mean extensive copying, render on intel, copy over pci bus to nvidia for composition, copy back to system memory for the intel to display it. Horrible performance and power consumption.

Ah ok. Doesn’t sound good!

So, I just need to figure out why my X11 on Intel UHD 630 feels so slow.

Is there a way to switch to an Nvidia-only mode, without changing my installed drivers? (I’m using Gnome desktop)

Nvidia only mode is only available from bios (only on some hardware). This shouldn’t require changing drivers, though.