Ubuntu 19.04 doesn't detect my HDMI display

To help people having the same problem, here are the steps I did following @generix’s pointers.

My laptop has an AMD Ryzen 4800H (with an iGPU) with NVIDIA RTX2060 dGPU. I installed Xubuntu 18.04.4. Initially, I could not get to the login window, after installing the nvidia-driver-440, select nvidia from prime-select, and backlist the nouveau kernel module, I was able to login but I can only see 1 (connect to DP) out of the 3 screens.

Here are the steps to fixes (I am retracing my steps, but if any of these are unneeded, let me know)

  1. according to @generix, Ubuntu 20.04 may work better but I managed to get 18.04 to work, so either will apply
  2. after a fresh installation and reboot, system won’t show the login window, press ctrl+alt+F2 to get a tty terminal, login with your account, and run
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-driver-440
  1. blacklist nouveau module by typing sudo nano /etc/modprobe.d/disable-nouveau.conf and add
blacklist nouveau
alias nouveau off
alias lbm-nouveau off
options nouveau modeset=0
  1. now if you do a reboot, you should be able to see the log-in window (only 1 display is on), but the below steps can still be completed in a terminal window in case graphics is still not working.
  2. go to this post by @generix (GeForce GTX 1650 Ti and Linux Mint 19.3 - #8 by generix), and download the kernel 5.6 linux kernel deb files, and install them by
sudo dpkg -i linux-*.deb
  1. not sure it is needed, but I did a reboot, and then reinstalled nvidia driver by
sudo apt-get install --reinstall nvidia-driver-440
  1. type
sudo prime-select nvidia

in the command line to set nvidia as the primary gpu
8. type sudo nano /usr/share/X11/xorg.conf.d/10-amdgpu.conf, replacing Driver "amdgpu" by Driver "modesetting"
9. type sudo nano /usr/share/X11/xorg.conf.d/10-nvidia.conf, insert

Option "PrimaryGPU" "Yes"

inside the OutputClass section (the only section).
10. create optimus.desktop file by

sudo nano /etc/xdg/autostart/optimus.desktop

and insert the below content

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
  1. copy optimus.desktop to /usr/share/gdm/greeter/autostart/ by
sudo cp  /etc/xdg/autostart/optimus.desktop /usr/share/gdm/greeter/autostart/
  1. see @generix’s post above, go to amdgpu - kernel/git/firmware/linux-firmware.git - Repository of firmware blobs for use with the Linux kernel and download all .bin files starting with “renoir”, and then in the terminal,
sudo cp -a renoir*.bin /lib/firmware/amdgpu
  1. type sudo update-initramfs -u to add the new renoir module
  2. now do a reboot, you should now see all screens,
    xrandr -q should also list all screens
    nvidia-smi should show the gpu info
    glmark2 should print the nvidia opengl driver is in use

if I miss any steps, or the orders of these are misplaced, please feel free to let me know and I can edit.