AMD GPU and NVIDIA RTX 2060 together in a Notebook problems

Dear all,
just bought an ASUS TUF Gaming Notebook with an AMD Ryzen 3750h (integrated GPU) and an RTX 2060 (6GB).
Got, compiled and got running latest linux 5.6-RC7 with current NVIDIA 440.64 driver (patched to make it compilable).
X11 only runs with integrated AMD GPU (PCI:5:0:0). The NVIDA (PCI:1:0:0) kernel drivers get loaded without problems but no X11 configuration can make this thing working.
I am always getting the “no displays usable” message stuff in Xorg.log.0.
No bumblebee on the system. I do not want both GPUs working simultanously - only the NVIDIA GPU.
It there any chance to get this working???
I tried everything from “blacklist amdgpu”, over modesetting tweaks, etc. Nothing.
I am not a hardware guy but I guess that the laptop screen is wired to the amdgpu and the nvidia driver is unable to take it over.
Why is the X11 stuff always such a configuration war?

It’s possible, in contrast to an intel/nvidia combo it doesn’t get autoconfigured by distros. Which distribution are you using?

I am using plain Debian 10 (Buster) 64bit. When using NVIDIA GPU, the mode seems to be set but I only see a blank screen.
In Xorg.log.0, I can see:
[ 81.902] (–) NVIDIA(GPU-0): DFP-0: 165.0 MHz maximum pixel clock
[ 81.902] (–) NVIDIA(GPU-0):
[ 81.902] (==) NVIDIA(0):
[ 81.902] (==) NVIDIA(0): No modes were requested; the default mode “nvidia-auto-select”
[ 81.902] (==) NVIDIA(0): will be used as the requested mode.
[ 81.902] (==) NVIDIA(0):
[ 81.902] (–) NVIDIA(0): No enabled display devices found; starting anyway because
[ 81.902] (–) NVIDIA(0): AllowEmptyInitialConfiguration is enabled
[ 81.903] (II) NVIDIA(0): Validated MetaModes:
[ 81.903] (II) NVIDIA(0): “NULL”
[ 81.903] (II) NVIDIA(0): Virtual screen size determined to be 640 x 480
[ 81.903] (WW) NVIDIA(0): Unable to get display device for DPI computation.
[ 81.903] (==) NVIDIA(0): DPI set to (75, 75); computed from built-in default
[ 81.903] (II) NVIDIA: Using 24576.00 MB of virtual memory for indirect memory
[ 81.903] (II) NVIDIA: access.
[ 81.952] (II) NVIDIA(0): Setting mode “NULL”
[ 81.964] (==) NVIDIA(0): Disabling shared memory pixmaps
[ 81.964] (==) NVIDIA(0): Backing store enabled
[ 81.964] (==) NVIDIA(0): Silken mouse enabled
[ 81.964] (**) NVIDIA(0): DPMS enabled

So “Setting mode “NULL”” might be the problem?
My xorg.conf looks like this (snippet, I have cut the modelines computed by another AMDGPU run of X11):

Section “Device”
Identifier “Device1”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BusID “PCI:1:0:0”
EndSection

Section “Device”
Identifier “Device0”
Driver “amdgpu”
BusID “PCI:5:0:0”
Option “PrimaryGPU” “yes”
EndSection

Section “Screen”
Identifier “Screen0”
Device “Device1”
Monitor “Monitor0”
DefaultDepth 24
Option “AllowEmptyInitialConfiguration” “True”
SubSection “Display”
Depth 24
Modes “1920x1080x59.9”
EndSubSection
EndSection

Because I am using lightdm as the wm, I added in /etc/lightdm/iightdm.conf:

[Seat:*]
display-setup-script=/etc/lightdm/display_setup.sh

And the script contains:

#!/bin/sh
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

That’s everything I found so far. But still not working (only with AMDGPU alone).

Cheers, Ingo.

Can you please run sudo nvidia-bug-report.sh and attach the resulting nvidia-bug-report.log.gz file to your post?

Two changes needed in your xorg.conf:
Replace
Driver “amdgpu”
with
Driver “modesetting”
and remove
Option “PrimaryGPU” “yes”
since you want the nvidia gpu to be primary.

Thanks for the suggestions, I will give it a try after work. Would you recommend to purge the AMDGPU (PCI:5:0:0) entry entirely?

No, it’s necessary, it just needs the two changes.

Dude, you are awesome! The “modesetting” did the trick. Works like a rock (I am going to write everything down in a PDF document for other users).
Proof:


Thanks a lot.

Topic solved, see below. Have to configure AMDGPU not with amdgpu driver but with modesetting driver. After that, linux 5.6-RC7 with NVIDIA 440.64 (patched for 5.6-RC7 to make it compilable) works great.
Btw, because I think that more and more AMD Ryzen Notebooks will appear on the market, the Linux kernel 5.6 is a must because the CPU throttles down to 400MHz permanently once overheated. This is fixed in kernel 5.6+ only.
Thank you!

Just for completeness, this also works with the amdgpu driver instead of modesetting, just the xrandr commands have to be adopted to it,
xrandr --setprovideroutputsource modesetting NVIDIA-0
has to become
xrandr --setprovideroutputsource amdgpu-blahblah NVIDIA-0
(use xrandr --listproviders to get the correct name)
or simply
xrandr --setprovideroutputsource 0 1
I just recommend using the modesetting driver for two reasons:

  1. on distros with PRIME infrastructure like Ubuntu this will make prime-select work since it then thinks it’s an intel
  2. depending on amdgpu kernel/DDX versions this sometimes has sideffects like graphical artifacts / dual mouse pointers, etc.