Can't get internal and external monitor working simultaneously with 20.04 on laptop with AMD Ryzen 7 4800H and Nvidia RTX 2060

Solution 1:

I managed to the the AMD graphics working using the experimental support for Renoir in the Linux kernel that ships with Ubuntu 20.04.

You need to add amdgpu.exp_hw_support=1 to /etc/default/grub.

To do this, open the file for editing as root, for example run

sudo edit /etc/default/grub

And to the line beginning GRUB_CMDLINE_LINUX_DEFAULT=, to the list of parameters in double quotes, add amdgpu.exp_hw_support=1. For example, depending on what you had before, the line may look like this after editing:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amdgpu.exp_hw_support=1"

Save the file and exit, and then run this command to make the change effective:

sudo update-grub

and reboot. Now, blacklist the nouveau driver. To do this, create a new configuration file in /etc/modprobe.d/ using for example

sudo nano /etc/modprobe.d/blacklist-nouveau.conf

Add the following entries:

blacklist nouveau
options nouveau modeset=0

save changes and exit (ctrl+x if using nano). Now update initramfs

sudo update-initramsfs -u

Reboot. This supports both internal and external displays.

Still no nvidia graphics though. It would be good to know a way to get this machine (AsusTUF with Ryzen 7 4800H and RTX 2060) to use switchabme AMD/Nvidia graphics.

EDIT: Activating the NVidia Card on internal/external monitors (HDMI)

If you are happy to use integrated graphics only (amdgpu driver ) read no further. To change to NVidia graphics continue.

Start by purging any previous installations of the NVidia driver, in the terminal:

sudo apt-get remove --purge '^nvidia-.*'
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf (if present)

Reboot the system. Now, reinstall the NVidia drivers

sudo apt-get install nvidia-driver-440

Edit the X11 configuration files for for amdgpu and nvidia drivers. These are located in /usr/share/X11/sorg.conf.d/. First, change the conf file for amdgpu:

sudo nano /usr/share/X11/xorg.conf.d/10-amdgpu.conf

Change the file contents so it looks like:

Section "OutputClass"
    Identifier "AMDgpu"
    MatchDriver "amdgpu"
    Driver "amdgpu"
    Option "PrimaryGPU" "no"
EndSection

Now, change the conf file for NVidia:

sudo nano /usr/share/X11/xorg.conf.d/10-nvidia.conf

Edit the file with the following entries

Section "OutputClass"
   Identifier "nvidia"
   MatchDriver "nvidia-drm"
   Driver "nvidia"
   Option "AllowEmptyInitialConfiguration"
   Option "PrimaryGPU" "yes"
   ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

Reboot the system. This solution worked for me. You should now have a working system with Nvidia drivers for both internal/external monitor configuration using HDMI (I don't have display-port or USB-C to test).

To revert back to the amdgpu swap the flags for the "PrimaryGPU" entries from "yes" to "no" as appropriate. This solution is sub-optimal and I will continue to look for a more robust swapping solution (e.g. nvidia on-demand). As a side note, I was unable to get anything to work properly by updating the kernel (tried 5.5.19 & 5.6.19). Although there are some interesting features that will benefit this laptop in newer kernel versions. The Nvidia module did not install correctly in my attempts (maybe if compiled the integration with the rest of the system might be more robust).

Solution 2:

I am having same laptop. after trying lots of things what worked for me.

  1. Kernel 5.7.15 ( or later from https://kernel.ubuntu.com/~kernel-ppa/mainline/) this kernel have drivers for amd cpu and apu both, will enable to use hdmi/external monitor. (remove amdgpu or amdgpu-pro if already installed)

  2. Nvidia PPA sudo add-apt-repository ppa:graphics-drivers/ppa && sudo apt-get upgrade && sudo apt-get update sudo apt-get install nvidia-driver-450