Can no longer use discrete GPU GM108M

I have a Samsung Notebook 7 Spin laptop which has an Intel HD Graphics 520 and NVIDIA GM108M. By default only the Intel graphics works. I used to be able to use this command to use the NVIDIA:

xrandr --setprovideroutputsource modesetting NVIDIA-0

However now it says “Could not find provider with name NVIDIA-0”. In xrandr output, the second provider is now also named “modesetting”, and has no capabilities:

xrandr --listproviders 
Providers: number : 2
Provider 0: id: 0x65 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 3 associated providers: 0 name:modesetting
Provider 1: id: 0x3f cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:modesetting

Here’s the output:

This looks like a bug in the modesetting driver/xserver in xorg 1.20.1. The modesetting driver is configured to just drive the igpu, yet it also grabs the nvidia device so there’s nothing left for the nvidia driver.
For a quick workaround, you could remove nvidia-drm.modeset=1 from the kernel cmdline but then you will get tearing, of course.
You could also see what happens when you swap the intel and nvidia sections of /usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.confthough I don’t think that will have an effect.
Lastly, you could use an old style xorg.conf like here:
But then you can’t switch to intel.
In any case, you should report that to your distribution’s bugzilla.

Thanks. Using the old style xorg.conf in the link worked for me. Removing nvidia-drm.modeset=1 and swapping the intel and nvidia sections in 10-nvidia-drm-outputclass.conf didn’t seem to have any effect.

Since you said it’s a bug in xorg 1.20.1, should I report it to xorg rather than my distro? I’m using Arch Linux [testing], which can include new and unstable versions of packages.

Same problem here with “standard” (not testing) Arch Linux on a laptop with intel and nvidia graphics, it occurred to me this morning after a system upgrade that upgraded the nvidia package from 396.54-1 to 410.57-2.
Xorg (1.20.1-1) did not get upgraded and it worked with nvidia 396.54, so I’m not sure it’s an Xorg problem.
An xorg.conf adapted from the one generix kindly linked works for me too.

This is odd, then. Looks like the driver doesn’t properly register with xorg. Does not seem to be a widespread problem at the moment, though. Anyway, reporting it to your distro shouldn’t hurt.

It works for me now in Arch with xorg 1.20.1-1 (same as before), linux 4.18.12-arch1-1 (new version), nvidia 410.57-4 (same upstream version, new build against the new kernel)