Unable to switch resolutions in laptop screen when using discrete nvidia (instead of AMD iGPU)

Hello there.
I have a Legion Pro 5 ( HW probe of Lenovo Legion 5 Pro 16ACH6H... #8767df67f4 ) running ubuntu 22.04 on xorg with a custom built kernel (although the issue is still present with the stock one).
It’s main screen features a display at 2560x1600 (which is too much for my 50sh eyes), and I use a bigger external monitor ( benq 27") at 1920x1080 over HDMI.

While running on hybrid mode (amdgpu) I can switch rsolution in any of the screens.
In order to save the 2 Gbytes amdgpu uses for VRAM, I disabled it from BIOS and I am now running with the discrete nvidia card only.

Since then, I can not switch the onboard display resolution using gnome ‘display’ tool, which shows only the native 2560x1600 in its resolution options; but I can on the external monitor. If I go back to hybrid I can change onboard display resolution perfectly.

Here is in easy to read text output:

$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x1b7 cap: 0x1, Source Output crtcs: 4 outputs: 6 associated providers: 0 name:NVIDIA-0
$ xrandr 
Screen 0: minimum 8 x 8, current 4480 x 1600, maximum 32767 x 32767
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.94    59.93  
DP-4 connected 2560x1600+1920+0 (normal left inverted right x axis y axis) 344mm x 215mm
   2560x1600     60.00*+ 165.00  

So, I assume that xrand is not being able to read the display resolution list from my main monitor.

I’ve attached an nvidia-bug-report.sh output.
nvidia-bug-report.log.gz (1.1 MB)

Also worth mentioning I can see these in dmesg:

$ dmesg -T|grep drm
[lun jun  3 03:10:47 2024] ACPI: bus type drm_connector registered
[lun jun  3 03:10:48 2024] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[lun jun  3 03:10:49 2024] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[lun jun  3 03:10:57 2024] systemd[1]: Starting Load Kernel Module drm...
[lun jun  3 03:10:57 2024] systemd[1]: modprobe@drm.service: Deactivated successfully.
[lun jun  3 03:10:57 2024] systemd[1]: Finished Load Kernel Module drm.
[lun jun  3 03:11:00 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:08 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:13 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 03:11:15 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:21:20 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:21:20 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:21:20 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:21:20 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:22:23 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:22:23 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:22:23 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 07:22:23 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 11:50:08 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 11:50:08 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 11:50:08 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 11:50:08 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 18:50:00 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 18:50:00 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownershi
p
[lun jun  3 18:50:00 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 18:50:00 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 20:55:43 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 20:55:43 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 20:55:43 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[lun jun  3 20:55:43 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 07:26:34 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 07:26:34 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 07:26:34 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 07:26:34 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 21:06:16 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 21:06:16 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 21:06:16 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership
[mar jun  4 21:06:16 2024] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership

Trying to understand what is wrong there, but I got nowhere.
These are my modprobe.d options for nvidia. Notice bumblebee, which i never could make it work as expected.

$ grep modeset /etc/modprobe.d/*
/etc/modprobe.d/nvidia-graphics-drivers-kms.conf:# Set value to 0 to disable modesetting
/etc/modprobe.d/nvidia-graphics-drivers-kms.conf:options nvidia-drm modeset=0
sjmuniz@void:~/br$ grep nvidia /etc/modprobe.d/*
/etc/modprobe.d/blacklist-framebuffer.conf:blacklist nvidiafb
/etc/modprobe.d/bumblebee.conf:# do not automatically load nouveau as it may prevent nvidia from loading
/etc/modprobe.d/bumblebee.conf:# do not automatically load nvidia as it's unloaded anyway when bumblebeed
/etc/modprobe.d/bumblebee.conf:blacklist nvidia
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-current
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-current-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-455
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-450
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-450-server
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-440
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-440-server
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-435
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-430
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-418
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-418-server
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-410
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-driver-390
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-387
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-387-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-387
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-384
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-384-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-384
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-381
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-381-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-381
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-378
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-378-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-378
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-375
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-375-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-375
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-367
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-367-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-367
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-364
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-364-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-364
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-361
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-361-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-361
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-358
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-358-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-358
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-355
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-355-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-355
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-352
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-352-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-352
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-349
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-349-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-349
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-346
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-346-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-346
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-343
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-343-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-343
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-340
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-340-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-340
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-337
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-337-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-337
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-334
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-334-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-334
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-331
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-331-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-331
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-325
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-325-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-325
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-319
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-319-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-319
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-313
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-313-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-313
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-310
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-310-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-310
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-304
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-304-updates
/etc/modprobe.d/bumblebee.conf:blacklist nvidia-experimental-304
/etc/modprobe.d/nvidia-graphics-drivers-kms.conf:# This file was generated by nvidia-driver-535
/etc/modprobe.d/nvidia-graphics-drivers-kms.conf:options nvidia-drm modeset=0
/etc/modprobe.d/nvidia-power-management.conf:options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp

Thanks!

¿No one?