Adding Nvidia prime-offloading support to mhwd

Nvidia added support for prime-offloading in the driver 435, which is much more stable than unofficial utilities like bumblebee, while still allowing usage of both the Intel and NVIDIA card without restarting XOrg (prime). Additionally, prime-offloading doesn't face the issue @jonathon outlined in this post. The reason I'm bringing this up is that bumblebee just isn't stable enough. I've helped multiple users that faced issues with bumblebee (either not allowing their laptop to boot at all or crashing steam games) which were solved by setting up prime offloading instead.

Currently, the manual setup is as follows:

  1. Install video-nvidia-435xx using mhwd
  2. Delete /etc/X11/mhwd.d/nvidia.conf and/or any other mhwd generated files in /etc/X11/xorg.conf.d/ and /etc/X11/mhwd.d/ except the keyboard config.
  3. Create a new file /etc/X11/xorg.conf.d/01-nvidia-offloading.conf and paste the following:
Section "ServerLayout"
  Identifier "layout"
  Option "AllowNVIDIAGPUScreens"
  Screen 0 "iGPU"
EndSection

Section "Device"
  Identifier "iGPU"
  Driver "intel"
#  BusID "PCI:0:2:0"
  Option "TearFree" "true"
  Option "AccelMethod" "sna"
  Option "DRI" "3"
EndSection

Section "DRI"
    Group "video"
    Mode 0666
EndSection

Section "Extensions"
    Option "Composite" "Enable"
    Option "RENDER" "Enable"
EndSection

Section "Screen"
  Identifier "iGPU"
  Device "iGPU"
EndSection

Section "Device"
  Identifier "nvidia"
  Driver "nvidia"
#  BusID "PCI:1:0:0"
EndSection
  1. Consider adding an alias to run programs with the nvidia card: alias nvr="__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"

(Setup stolen from NVIDIA 435 driver looks exciting)

Additionally, the manjaro team could add code to run steam using the nvidia card to steam-manjaro.

If nobody from the manjaro team wants to pick this up, I'd be glad to test and create a config for mhwd.

According to this article
https://www.phoronix.com/scan.php?page=news_item&px=NVIDIA-435.17-Linux-Driver
You need the xorg-server 1.21

For the NVIDIA PRIME render offload support, they require some recent commits to the X.OrgServer that sadly isn't in any released version but will be there for the eventual xorg-server 1.21 release.

Are you currently running the setup you mentioned and works?

Manjaro already ships with a compatible xorg server.

And according to this


all should be set then ...

I know. Multiple people I've helped are running it too.

This will make mhwd options list for Nvidia even more confusing.
I guess Manjaro will eventually have to adopt optimus-{manager|switch} logic.
I use manager in hybrid mode and quite happy with it...

Except optimus manager and optimus switch use some of the same hacks for switching and other stuff and therefore end up having some of the same problems that bumblebee has.

Let's stop all this fragmentation once and for all by adopting the official and most stable way to use the dGPU on optimus devices.

1 Like

The official and the most stable way as you mean it isn't the one-and-only-the-best solution for everyone. Say, I don't want my dGPU to be enabled when on battery power, and most people think the same I guess. But your suggestion is to keep dGPU always running. Optimus-manager has means to control this behavior without much hassle.
Another thing I can think of is a bunch of issues happening on modesetting driver, it works fine for some devices, and not that good on others. Again, optimus-manager has a set of options that allow setting either modesetting or intel driver for iGPU, and many more. In other words, it is already more flexible than what you offer.

Optimus-manager has means to control this behavior without much hassle.

Yea no. Tried that, froze the system. Had to chroot in to uninstall it. Same with bumblebee. Nvidia's solution does one thing right: It works. It works for games, it works for programs, it doesn't freeze the system.

I understand that optimus-manager may work just fine for you and that's great! But you must consider that some people WILL have problems with the more hacky solutions.

I'm not arguing that you shouldn't be allowed to use optimus-manager or related tools, not at all! I'm simply saying that Nvidia prime-offloading should be the default mode of operation for manjaro users because it offers the highest success rate from the data I have collected. Bumblebee is just simply too unstable and unreliable.

Users are still free to manually switch to a solution that does a slightly better job at preserving the battery, but its important that we finally get optimus laptops working out of the box without any manual intervention.

1 Like

I agree with that (and OT request). The point is, this discussion has been done already and Manjaro Team knows about it. They are probably considering the best way to go with this, which obviously needs a lot of thinking, coding and designing.

Providing a safe successful 1st installation for Optimus or multi-GPU systems is a legitimate perspective. Then a user can go for a better setup, if needed.

It's been very long time that bumblebee is considered to be removed from default config for dual-gpu systems (even Desktops/non-Optimus).

Time is money?...

Great to hear you agree with my perspective!

As outlined in my original post, I'd be interested in adding the relevant bash scripts/"configs" to mhwd myself if team members are interested in adopting the proposal.

1 Like

You don't need to do step 3 since nvidia-xxxxx-utils provides the necessary Xorg configuration for PRIME Offload to work on both Intel and AMD system. That configuration file is located on/usr/share/X11/xorg.conf.d/10-amdgpu-nvidia-drm-outputclass.conf for AMD and /usr/share/X11/xorg.conf.d/10-intel-nvidia-drm-outputclass.conf for Intel.

+1 for mhwd integration. I'm too stupid to set this up myself.

If this really does work then it’ll be good to see the back of fumblebee. Which hasn’t seen an update in over 6 years and only seems to work for 1/10 users.

It does work. I've helped people that had trouble with bumblebee set it up. Manjaro is a distro known for its hardware support, so having optimus laptops just not work for some/(most?) users is not acceptable. Nvidia's solution works for all users I've tried it with so far (although I wish they would use DRI_PRIME instead of whatever the f*** they're using to name their variables... Well I also wish they would just open source their drivers but I digress).

Forum kindly sponsored by