I have the exact same issue with intel12 and nvidia 3080 ti on a advanced optimus laptop.
I first thought it was an issue from Aquamarine (AQ), the Wayland backend used by Hyprland, but i can reproduce the issue without a graphical environment as well.
# enable finegrained power management
boot.extraModprobeConfig = ''
options nvidia NVreg_EnableGpuFirmware=0 NVreg_DynamicPowerManagementVideoMemoryThreshold=0 NVreg_DynamicPowerManagement=0x02 NVreg_UsePageAttributeTable=1 NVreg_InitializeSystemMemoryAllocations=0 NVreg_PreserveVideoMemoryAllocations=1
options nvidia-drm modeset=1 fbdev=1
'';
boot.kernelParams = ["nvidia-drm.modeset=1" "nvidia.NVreg_EnableGpuFirmware=0" "nvidia.NVreg_DynamicPowerManagementVideoMemoryThreshold=0" "nvidia.NVreg_DynamicPowerManagement=0x02" "nvidia.NVreg_UsePageAttributeTable=1" "nvidia.NVreg_InitializeSystemMemoryAllocations=0" "nvidia.NVreg_PreserveVideoMemoryAllocations=1"];
Maybe it is possible to manipulate the nvidia driver from the udev rules as a workaround
The issue also happen on the open driver
After a clean boot sudo cat /sys/kernel/debug/dri/129/framebuffer
is empty
After plugging the external monitor, it contains
framebuffer[115]:
allocated by = [fbcon]
refcount=1
format=XR24 little-endian (0x34325258)
modifier=0x0
size=1920x1080
layers:
size[0]=1920x1080
pitch[0]=7680
offset[0]=0
obj[0]:
name=0
refcount=2
start=00100000
size=8294400
imported=no
along with my wm processes framebuffers.
After unplugging, the other framebuffers are cleaned up, but fbcon allocation remains
Maybe it is related to
EDIT: issue created at RTD3 dont allow gpu to sleep after a monitor has been plugged and unplugged on prime reverse sync · Issue #759 · NVIDIA/open-gpu-kernel-modules · GitHub