Black screen when using eGPU output with Dell XPS (iGPU+dGPU)

I have problem with getting my monitor to work using eGPU HDMI or Displayport output.
Monitor stays black and no signal received.
Use case is to play games using eGPU output and keep laptop closed.

This is first time I am trying eGPU and get this to work and have been banging my head for couple weeks now.

Ubuntu 18.04
DELL XPS 15 9570 (which has intelGPU and GTX1050)
Raxer Core X - eGPU
GTX 970

/etcX11/xorg.conf

Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "NVIDIA-0"
    Driver "nvidia"
    BusID "PCI:07:0:0"
    Option "AllowEmptyInitialConfiguration"
    Option "AllowExternalGpus" "True"
EndSection

~/.profile has

export DRI_PRIME=1

Maybe this is just configuration error but I have not figured it out…

eGPU-info.txt (4.79 KB)

Please see this thread:
https://devtalk.nvidia.com/default/topic/1048095/linux/rtx-2070/1

Thank you generix for leading me to the right path!

I got now monitor working using eGPU displayport by creating
/usr/share/X11/xorg.conf.d/10-nvidia.conf

Section "ServerLayout"
    Identifier     "layout"
    Screen      0  "nvidia" 0 0
    Inactive       "intel"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
EndSection

Section "Device"
    Identifier     "intel"
    Driver         "modesetting"
    Option         "AccelMethod" "none"
    BusID          "PCI:0:2:0"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:7:0:0"
    Option         "AllowEmptyInitialConfiguration"
    Option         "AllowExternalGpus" "true"
    Option         "PrimaryGPU" "true"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Monitor        "Monitor0"
EndSection

I still have problem that Frame Rate must be really low (like <1) as everything renders so slowly.
I tried different modelines but no success yet.

Section "Monitor"
    Identifier     "Monitor0"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Modeline       "3840x2160_60.00" 593.41 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync
EndSection

Any tips how to improve the performance?

Please create and attach a new nvidia-bug-report.log

Attaching new nvidia-bug-report.log

Unfortunately, no Xorg logs included. Please run
sudo journalctl -b0 --no-pager _COMM=gdm-x-session >xorg.log
and attach that.

And here is xorg.log

Please add

Section "Files"
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/xorg/modules"
EndSection

to the xorg.conf.

I created /etc/X11/xorg.conf with above lines but no better effect was noticed.

xrandr --listproviders                      
Providers: number : 3
Provider 0: id: 0x101 cap: 0x0 crtcs: 4 outputs: 4 associated providers: 0 name:modesetting
Provider 1: id: 0x66 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 0 name:modesetting
Provider 2: id: 0x3f cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:modesetting
DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: llvmpipe (LLVM 7.0, 256 bits)

This is the same output for all DRI_PRIME’s. Should one say something NVIDIA GTX970 related?

DRI_PRIME only applies to nouveau.
The Xserver can’t find the nvidia driver because the path to it is not set, that’s why you have to add the Files Section.
Please post your current xorg.conf and attach a new output of
sudo journalctl -b0 --no-pager _COMM=gdm-x-session >xorg.log

/etc/X11/xorg.conf

Section "Files"
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/xorg/modules"
EndSection

Please check if the file
/usr/lib/x86_64-linux-gnu/nvidia/xorg/nvidia_drv.so
exists.

I can only find
/usr/lib/x86_64-linux-gnu/nvidia-418/xorg/nvidia_drv.so

so changing ModulePath to that migth help?

Edit:
Nope

Section "Files"
        ModulePath "/usr/lib/x86_64-linux-gnu/nvidia-418/xorg,/usr/lib/xorg/modules"
    EndSection

Did not help. Stuck in login screen and needed to use Wayland to change setting back.

Looks like the Ubuntu driver ppa changed the path again, so the path you added should be correct. Can you put that back in place and run
sudo journalctl -b0 --no-pager _COMM=gdm-x-session >xorg.log
again?

New xorg.log

Edit. wrong setup at that

Ok, the X config is correct now but the kernel driver is failing:

(EE) NVIDIA: Failed to initialize the NVIDIA kernel module. Please see the
 (EE) NVIDIA:     system's kernel log for additional error messages and
 (EE) NVIDIA:     consult the NVIDIA README for details.

So please keep the config in place and create a new nvidia-bug-report.log and attach it.

(I made mistage and forgot prime-select intel in the previous run)

Now new logs.

Ok, the xserver currently tries to offload from the egpu to your internal nvidia gpu. Try using the kernel parameter
nogpumanager
and remove the file
/usr/share/X11/xorg.conf.d/11-nvidia-prime.conf

I added kernel parameter nogpumanager according these instructions.

And now still have those:
/etc/X11/xorg.conf
/usr/share/X11/xorg.conf.d/10-nvidia.conf

and I have had no
/usr/share/X11/xorg.conf.d/11-nvidia-prime.conf
so I did not delete it…

With this setup it still stuck and loop back into login screen.

I still have not got this to work.
Anyone have any ideas or good links to check -> what could I try next?