Assistance with hybrid NVIDIA & Intel graphics using NVIDIA as main GPU for applications

Background - I have a hybrid system with Intel integrated and NVIDIA closed drivers. I heard of issues with the 495 driver, so I downgraded to the second most recent one. My goal is to use the NVIDIA GPU by default via prime, as optimus-manager is no longer in the main repos. Following this link. I have tried under the section " Discrete card as primary GPU" and am running into issues such as no display after following the instructions. That article mentions the file /etc/X11/xorg.conf.d/10-gpu.conf with noveau. I am using the proprietary drivers, and am wondering what I should do to get the right config file so the display will come up, as the default for /etc/X11/xorg.conf.d/10-gpu.conf displayed on the linked page did not work and resulted in no X server

I’ve followed up by trying to follow the directions here. Specifically, the directions for the area titled " Using the NVIDIA Driver as an RandR 1.4 Output Source" and using it as an output source and also the commands xrandr --setprovideroutputsource NVIDIA-G0 modesetting and xrandr --auto. The command above the aforementioned through an error saying “Could not find provider with name NVIDIA-0” although there is a provider under xrandr --listproviders listed as NVIDIA-G0. Unfortunately I am unable to utilize the discrete GPU for everything but the display without just using prime-run from the terminal, which is a pain. This is a desktop and power consumption isn’t as high a priority, and I play games and use a few intensive applications so I want the NVIDIA card as default. I had success with earlier drivers and optimus-manager-qt. But now that’s no longer the official way to do it as optimus-manager is now in the AUR. Any help is appreciated as I’m out of ideas.

Make the file something like 99-gpu.conf
(the numbers dictate load order)
Also … you cant just copy/paste those instructions.
You want correct values … which you can get using lspci or xrandr, etc … I only have the one gpu, but I will give an example:
First I check my pci addresses:

$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 4 associated providers: 0 name:AMD Radeon Vega 8 Graphics @ pci:0000:02:00.0

There we have “pci:0000:02:00.0” which translates to BusID "PCI:2:0:0"
Which I will use for both the nvidia and intel entries below…

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Inactive "nvidia"
    Option "AllowNVIDIAGPUScreens"

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:2:0:0"

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"

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

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

Then theres these things too:

The nvidia-xconfig(1) utility can be used to update the X configuration file for using the NVIDIA driver as an output source provider.

$ nvidia-xconfig --prime

See the nvidia-xconfig(1) man page for details.

The X server does not automatically enable displays attached using the output sink in this configuration. To do that, use the xrandr command line tool.

For NVIDIA as an output source:

$ xrandr --setprovideroutputsource modesetting NVIDIA-0
$ xrandr --auto

For NVIDIA as an output sink:

$ xrandr --setprovideroutputsource NVIDIA-G0 modesetting
$ xrandr --auto

This pair of commands can be added to your X session startup scripts, for example by putting them in $HOME/.xinitrc before running startx.

But … its worth noting that optimus-manager does not have a reverse-prime option … so what are you trying to emulate? You just want to turn off the intel iGPU and only use the nvidia dGPU ?

Well I’ve already had an issue with trying to input xrandr --listproviders. The output is as follows:

Providers: number : 2
Provider 0: id: 0x44 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 3 associated providers: 1 name:modesetting
Provider 1: id: 0x20f cap: 0x2, Sink Output crtcs: 4 outputs: 7 associated providers: 1 name:NVIDIA-G0

No PCI addresses to add to the file. What should I do next? No clue as I assume PCI addresses are supposed to be there.

Another note is the Intel iGPU is used for the display. I want the NVIDIA GPU to be used as primary like switching to it was done previously in optimus-manager.

EDIT: I found some PCI addresses by running sudo nvidia-xconfig --prime after two mentioned xrandr commands. Previous to that command I ran xrandr --setprovideroutputsource modesetting NVIDIA-G0 and also xrandr --auto and now after a reboot I get a blue no input screen from my monitor, I am guessing because the NVIDIA GPU is now primary. I got the same blue no input screen when switching via optimus-manager. But the weird thing is I’m not on the 495 driver version. I’m on 470.94-2 from Manjaro’s sources.

mhwd -l -d

Output of mhwd -l -d here. I’m trying to switch to the discrete GPU as primary and disable the intel one if possible. Are there other options to get the NVIDIA GPU as the primary one? I’m also confused to as what is causing no output when using the NVIDIA GPU as the only one and putting Intel as modesetting.

Also, I forgot to mention that typing in sudo xrandr --setprovderoutputsource modesetting NVIDIA-G0 results in the following output:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  35 (RRSetProviderOutputSource)
  Value in failed request:  0x20f
  Serial number of failed request:  16
  Current serial number in output stream:  17

Then you should follow this guide:
NVIDIA Optimus - ArchWiki
With the caveat that you should use mhwd for the driver removal/install, ex:

sudo mhwd -r pci video-hybrid-intel-nvidia-prime
sudo mhwd -r pci video-modesetting
sudo mhwd -i pci video-nvidia-470xx

I did every command you mentioned and followed that section and still get a black screen. I checked a virtual terminal after killing xorg and starting it up again. Said fatal error at least once. I reversed the steps to use the Intel driver as primary again and I get X back. What should I do next? I think something is bugged but I don’t know what… People have been complaining about NVIDIA graphics issues recently even on the stable branch. I thought it only impacted the 495xx branch but maybe 470xx is impacted as well? What logs can I provide?