Cannot get external monitor to work with nvidia + amdgpu

Hi all,

I’m struggling a lot with getting an external monitor to work on a amd/nvidia notebook. The external ports are connected to the nvidia card, the laptop screen is attached to the internal gpu.

I tried prime.sync and prime.offload. The latter works as described using the laptop screen only. All external ports are not possible to get to work. xrandr complains with failed to configure crtc 4 (e.g. when doing xrandr --auto). Similiar when using prime.sync: strange this here is the amdgpu provider has no capabilities:

Provider 0: id: 0x1b8 cap: 0x1, Source Output crtcs: 4 outputs: 5 associated providers: 0 name:NVIDIA-0
Provider 1: id: 0x206 cap: 0x0 crtcs: 4 outputs: 1 associated providers: 0 name:Unknown AMD Radeon GPU @ pci:0000:06:00.0

and so xrandr --setprovideroutputsource … is not working. When loading the modesetting driver, capabilites are there, but trying to activate the display fails again with xrandr: Configure crtc 4 failed (same as with prime.offload).

Doing a xrandr --verbose it shows that there is only one CRTC value 0 either for the laptop screen (for prime.offload) or the external screen (for prime.sync).

However, Ubuntu starts with both displays on and working. So it must work somehow. But I couldn’t figure out any difference from ubuntu to nixos. Also Ubuntu doesn’t use any xorg.conf file. Here is the provider list in Ubuntu:

xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x1b8 cap: 0x1, Source Output crtcs: 4 outputs: 5 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x1fc cap: 0x6, Sink Output, Source Offload crtcs: 4 outputs: 1 associated providers: 1 name:Unknown AMD Radeon GPU @ pci:0000:06:00.0

I then thought to define two screens each for one gpu and put them both in a server-layout (not using prime). Using the xserver module provided by NixOS I was not able to achieve this, because it generates several sections and while I can add stuff to some/all I was not able to define separate devices each with their own config (like BusID etc). The xserver.drivers config looks like the one to use, but it is marked internal.

I’m grateful for any hints to a solution where I can use an external screen and the notebook screen at the same time; any workaround is fine :woozy_face:

I’m using a current NixOS 21.05, tried some 5.x kernels, currently trying with 5.12.

I have the same problem.

I was able to get the external display to work using prime.sync, but only the external display; I could not get both displays working simultaneously.

I thought that it just wasn’t possible, but given it’s working on Ubuntu, there’s hope :slight_smile:

If you have the Xorg log from Ubuntu, that might help point out what’s missing on NixOS.

Thanks a lot for your reply. At least we’re not alone :slight_smile:

Yes good idea, I already tried to find differences between these two log files, but I’m not knowledgeable enough to mirror it into my nixos config. I also didn’t see things that caught my attention, but I probably just overlooked them or didn’t recognize them.

I uploaded some files here. Would be great if you could take a look. Thanks!

I also have this problem. I described it here: linux - How can I get my 3-screen Asus laptop setup (built-in, HDMI, and HDMI -> hub -> USB-C) working correctly with Nixos? - Super User but I haven’t gotten any (real) help.