Xrandr --listproviders lists two times modesetting, NVIDIA-0 missing

Dear Forum,

I am using an Nvidia Optimus card on Ubuntu 20.04.
The integrated GPU (intel) seems to work fine. Drivers for the nvidia card (GeForce GTX 950M) also seem to load.

$ cat /sys/module/nvidia_drm/parameters/modeset
Y

But I can’t get the system in a state to actually use the Nvidia card. (My goal is to use it Nvidia only / performance mode).

inxi -G
Graphics:
Device-1: Intel 4th Gen Core Processor Integrated Graphics driver: i915
v: kernel
Device-2: NVIDIA GM107M [GeForce GTX 950M] driver: nvidia v: 455.45.01
Display: server: X.Org 1.20.8 driver: modesetting
unloaded: fbdev,nouveau,nvidia,vesa
resolution: 1920x1080~60Hz, 1920x1080~60Hz
OpenGL: renderer: Mesa DRI Intel HD Graphics 4600 (HSW GT2)
v: 4.5 Mesa 20.0.8

$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x45 cap: 0x0 crtcs: 3 outputs: 3 associated providers: 0 name:modesetting
Provider 1: id: 0xda cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:modesetting

xrandr lists two modesetting providers, which seems odd. According to the forum here, a proper output would be on Nvidia-0 provider and one modesetting.

/var/log/Xorg.0.log
shows one Error:
(EE) Failed to load module “glxservernvidia” (module does not exist, 0)

which again is odd, since the module is called glxserver_nvidia with _

Finally my xorg.conf only works, when I mask the actual nvidia device section.
With nvidia device section, X doesn’t start and I only see a blinking underscore on a black screen.

Here is the full bug report: nvidia-bug-report.log.gz (745.1 KB)

Thanks to generix I was able to get the Performance Mode (NVIDIA-only) working.

The final step was to have no xorg.conf at all and let ubuntu prime-select handle all xorg configuration via files it autogenerates in /usr/share/X11/xorg.conf.d/
After deleting xorg.conf (and a lot of additional steps I’ve already done up to this point) - NVIDIA drivers are working fine now.

For comparison:

$ inxi -G
Graphics:
Device-1: Intel 4th Gen Core Processor Integrated Graphics driver: i915
v: kernel
Device-2: NVIDIA GM107M [GeForce GTX 950M] driver: nvidia v: 455.45.01
Display: server: X.Org 1.20.8 driver: modesetting
unloaded: fbdev,nouveau,nvidia,vesa resolution: 1920x1200~60Hz
OpenGL: renderer: GeForce GTX 950M/PCIe/SSE2 v: 4.6.0 NVIDIA 455.45.01

$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x1b8 cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x1de cap: 0x6, Sink Output, Source Offload crtcs: 3 outputs: 3 associated providers: 1 name:modesetting

hope this helps others also stumbling at this point!

Cheers and happy winter solstice!

Michael