Install Nvidia PRIME on Manjaro 18.1.4

The latest Manjaro 18.1.4 is a great new version with the new Linux Kernel 5.4. It also has xorg-server 1.20.6 which supports PRIME offloading for Nvidia dGPU. Installation of PRIME is pretty easy on my ThinkPad T480s with GeForce MX150.

  1. Remove bumblebee driver
  2. Install the NVIDIA driver (440.36)
  3. Remove /etc/X11/xorg.conf.d/90-mhwd.conf and /etc/modprobe.d/mhwd-gpu.conf
  4. Add /etc/X11/xorg.conf.d/optimus.conf
Section "ServerLayout"
  Identifier "layout"
  Screen 0 "intel"
  Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
  Identifier "intel"
  Driver "modesetting"
  BusID "PCI:0:2:0"
EndSection

Section "Screen"
  Identifier "intel"
  Device "intel"
EndSection

Section "Device"
  Identifier "nvidia"
  Driver "nvidia"
  BusID "PCI:1:0:0"
  Option "AllowEmptyInitialConfiguration"
EndSection
  1. Reboot.

After reboot, you can check GPU which should be Intel.

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) 

To use Nvidia GPU with a command, run:

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia <command>

For example:

$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep "OpenGL renderer"
OpenGL renderer string: GeForce MX150/PCIe/SSE2

P.S.

Additional Notes

No.1. For BusID, you need to use one that matches your real hardware. You can use lspci | grep -E "VGA|3D" to check.

$ lspci | grep -E "VGA|3D"
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
01:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX150] (rev a1)

No. 2. If you had installed other GPU solutions before, you may need to blacklist some video drivers by adding the following file before reboot.

/etc/modprobe.d/nvidia.conf:

blacklist nouveau
blacklist nvidiafb
blacklist rivafb
9 Likes

I think this belongs in how-tos and tutorials section, instead of General discussion.
Can someone move this please?

okay, moved

1 Like

Thanks Bob, and welcome to the community.

Finally something I can understand. Thanks!
But what are you doing against the tearing? tearfree option doesn't do anything now.

This works perfectly for me on plain Arch with the 440 driver. Thanks for this!

hey newbie here.

What is the difference between this and primusrun?

lspci | grep -E "VGA|3D

00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)
04:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (rev ff)

My graphic card is old and is not supported by new drivers. Can I install prime?

Yes. Not by this topic, though.
Use this to select your method
Options for Nvidia Optimus graphics - FAQ

1 Like

Thank you for this tutorial. I was hoping for another NVIDIA render-offload solution to replace bumblebee with and this tutorial is it until the nvidia-prime (in testing and unstable but not the stable branch of Manjaro repositories) package according to this arch wiki: https://wiki.archlinux.org/index.php/PRIME#PRIME_render_offload comes to the stable branch. Nvidia settings application can open without running the app using the NVIDIA card unlike bumblebee.

Currently that's all you can get. This solution is for newer cards/drivers, not for 390 and older.

I think we need to add this 99-amd-nvidia-prime-offload.conf.
There are going to be users who will have an amd/nvidia set up like I do and this one works for that.
I didnt want to just post it and prefer to link it to give credit to the person who wrote it.

Edit: nouveau needs to be blacklisted when using the amd/nvidia.
The user can install video-linux from mhwd, or they can install the xf86-video-amdgpu <- this is installed using pacman not mhwd. I have gotten a working set up either way. If they choose to do the amdpgu there should be no need to blacklist nouveau as it should not be installed. I can only use architect to install manjaro anyway so its faily easy for me to do the set up when installing anyway. For users who are able to use a gui installer. You will need to blacklist nouveau on top of the instructions to remove and xorg conf like 90-mhwd.conf.

Another way of following this great tutorial with a slight change is instead of creating the config file, one can install the nvidia-prime package (Requires Manjaro 18.1.5 and later which is the 29/12/2019 update and later) which comes with necessary Xorg configuration necessary for both intel/nvidia and amd/nvidia optimus PCs. You can learn more of the nvidia-prime package in the arch wiki link I posted in my first reply of this topic. I use the package in my intel/nvidia optimus laptop. To run programs with the nvidia card you just need to use the syntax: prime-run <command> for example prime-run glxinfo | grep "OpenGL renderer".

2 Likes

Thank you! This is exactly what was looking for!

1 Like

Forum kindly sponsored by