465.24.02 ubuntu 21.04 wayland no external monitor

I have a Dell Inspiron 7577 laptop with nVIDIA GeForce GTX 1060 with max-Q design running Ubuntu 21.04. It has a HiDPI screen 3840x2160 and I use fractional scaling at 175% with Gnome. nVIDIA driver is latest 465.24.02 from https://launchpad.net/~oem-solutions-group/+archive/ubuntu/nvidia-driver-staging?field.series_filter=hirsute
I used to have Xorg in previous Ubuntu releases but tried out Wayland described in:

Up to now I only have one issue with Wayland: connecting an external monitor to the HDMI connector freezes Ubuntu completely. Nothing is shown on the external monitor and power button hard reset is the only option. I could create a bugreport via ssh from another PC (30/04 15h28 event happened] nvidia-bug-report.log.gz (710.9 KB)

Please try setting kernel parameter

To use Wayland, I did already add to /etc/modprobe.d/nvidia-graphics-drivers.conf :

options nvidia_drm modeset=1

Verified with

sudo cat /sys/module/nvidia_drm/parameters/modeset

But I see in /var/log/kern.log

Apr 30 15:28:25 Dell7577Linux kernel: [14657.250608] [drm:__nv_drm_gem_nvkms_memory_prime_get_sg_table [nvidia_drm]] ERROR [nvidia-drm] [GPU ID 0x00000100] Failed to get memory pages for NvKmsKapiMemory 0x00000000297a062d

Apr 30 15:28:25 Dell7577Linux kernel: [14657.250634] BUG: kernel NULL pointer dereference, address: 000000000000000c

To my surprise, it seems that my laptop screen is being driven by my integrated Intel GPU.

lspci -vnnn | perl -lne 'print if /^\d+\:.+(\[\S+\:\S+\])/' | grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 630 [8086:591b] (rev 04) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] [10de:1c20] (rev a1) (prog-if 00 [VGA controller])

Both GPUs have the string “VGA Controller”.

Google Chrome “about:gpu” shows that Intel GPU is active
GPU0 VENDOR= 0x10de, DEVICE=0x1c20
Optimus true

“System Settings About” shows Intel:
Graphics: Mesa Intel HD Graphics 630 (KBL GT2)

nVIDIA X server settings shows nVIDIA:
nVIDIA (Performance Mode)
but presents only the PRIME Profiles section and nothing else

prime-select query

lsmod | grep nvidia
nvidia_uvm           1040384  0
nvidia_drm             61440  1
nvidia_modeset       1183744  1 nvidia_drm
nvidia              34910208  62 nvidia_uvm,nvidia_modeset
drm_kms_helper        245760  2 nvidia_drm,i915
drm                   552960  22 drm_kms_helper,nvidia_drm,i915

lsmod | grep i915
i915                 2371584  31
drm_kms_helper        245760  2 nvidia_drm,i915
cec                    53248  2 drm_kms_helper,i915
i2c_algo_bit           16384  1 i915
drm                   552960  22 drm_kms_helper,nvidia_drm,i915
video                  49152  3 dell_wmi,dell_laptop,i915

glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)

Matlab and Mathematica can use CUDA
Jupyter Notebook can use nVIDIA GPU via libcudnn8

If I compare with “Gnome on Xorg” it is clear the nVIDIA is driving the display in Xorg. So I am sure that Intel is driving the display in Wayland Gnome.

How can I force nVIDIA to be used to drive the display?

These were helpful diagnostic steps for me. I tread one step further and went into “Software & Updates” - “Additional Drivers” and saw that by default, the open source X.Org X Server - Nouveau display driver from xserver-xorg-video-nouveau had been selected for use with my NVIDIA GeForce GTX 1650 Ti. I changed the driver to the proprietary “Using NVIDIA driver metapackage from nvidia-driver-460 (tested),” rebooted, and my external monitor finally worked. Chrome about:gpu shows the NVIDIA card as active now. Thank you.