Setup Nvidia as Default Graphic Instead of Intel on Manjaro Gnome

Intro

So i got laptop with dual vga card Nvidia and Intel, the I install Manjaro with Gnome desktop on top of it.

Now, how I can set up Nvidia as default graphic driver instead of Intel on my manjaro system.

Install nvidia graphic driver on manjaro

To install nvidia graphic driver on manjaro, run the following command.

1
sudo mhwd -a pci nonfree 0300

Now reboot the system and check again the installed nvidia driver.

1
sudo mhwd -li

Make sure you got the video-hybrid-intel-nvidia-prime driver.

Check BusID of nvidia graphic card

Before going any further, check BusID of your nvidia graphic.

1
sudo lspci | grep -E "VGA|3D"

Below is the an example result.

00:02.0 VGA compatible controller: Intel Corporation XXLake-H GT2 [UHD Graphics XXX]
01:00.0 3D controller: NVIDIA Corporation GPXXM [GeForce GTX 10XX Ti Mobile] (rev a1)

The BusID for nvidia graphic card is PCI:1:0:0, and for intel is PCI:2:0:0.

Setup Xorg configuration for nvidia

By default the mhwd tool created the nvidia graphic driver configuration /etc/X11/xorg.conf.d/90-mhwd.conf.

Delete the default mhwd configuration and create another one.

1
2
sudo rm -f /etc/X11/xorg.conf.d/90-mhwd.conf
sudo vim /etc/X11/xorg.conf.d/optimus.conf

Change the BusID options as your own and paste the configuration.

Section "Module"
    Load "modesetting"
EndSection

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

Save.

Block nouveau and Enable nvidia-drm.modeset

Backup all default configuration at the /etc/modprobe.d/ directory.

1
2
sudo mkdir -p ~/backup-conf/
sudo mv /etc/modprobe.d/*.conf ~/backup-conf/

Create new blacklist configuration.

1
sudo vim /etc/modprobe.d/nvidia.conf

Paste the following configuration to block the nouveau kernel driver.

blacklist nouveau
blacklist nvidiafb
blacklist riafb

Save.

Next, enable the nvidia-drm.modeset by creating new configuration.

1
sudo vim /etc/modprobe.d/nvidia-drm.conf

Paste the following configuration.

options nvidia_drm modeset=1

Save.

Setup ourput source for GDM (Gnome Display Manager)

Create new configuration file.

1
sudo vim /usr/local/share/optimus.desktop

Paste the following configuration.

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

Save.

Now make it auto-start on the login.

1
2
sudo ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
sudo ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop

After that reboot the system.

Verify the nvidia driver

To verify our setup, run the following command.

1
glxinfo | grep -i vendor

Optionall, you can use the tool nvtop.

1
2
3
sudo pamac install nvtop

nvtop

Enjoy your system is fully using nvidia graphic card.