External monitor freezes when using dedicated GPU

Did you try this External monitor freezes when using dedicated GPU - #263 by dmakc ?

I’ve tried to make NVidia GPU primary rendering provider as described at NVIDIA Optimus - ArchWiki
I’ve created configuration file /etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf with recommended contents:

Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

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

And restarted Xorg session (logged out and logged in again).
Now all rendering is performed by NVidia’s dGPU and there is no freezes in glxgears/vkcube, cause reverse PRIME is not needed anymore. Ordinary PRIME (forward PRIME) is used in this setup. Yes, dGPU draws little more power, then Intel’s iGPU. But i’m ready to pay this price to get renderint without freezes. Especially while using AC power source.

I will test more and see what happens. But for now I am quite satisfied with the result. The external display works without freezing, the built-in display also works without problems.

This solution works GREAT!

Until I turn off the TV and walk away. When I come back, the UI freezes.

I’m not sure if this is directly related, but I’ve been having the exact same symptoms (2nd monitor [via HDMI] freezing) on my Ubuntu (wayland) desktop ever since upgrading from the 510 drivers. GeForce GTX1650. Reloading GNOME and/or power cycling the monitor unfreezes the screen. Let me know if/how to help debug.

My solution for now, on top of dmakc’s solution, is to put both internal and external displays in ā€œmirrorā€ mode. Then I can set internal display to 0% so it’s physically turned off.

In mirror mode, it still freezes when turning the TV back on, but after 15 seconds, KDE resets itself. That’s an acceptable work-around, and the rest of time is more stable than it has been in a long time!

Just checked up latest 570.133.07 and it seems nothing changed in context of current topic. Moreover, it doesn’t work for me without options nvidia NVreg_EnableGpuFirmware=0. :-(
No errors in the X.org logs, nor in the dmesg, but freezes in reverse PRIME are still here. The only positive change I’ve noticed with 570.133.07 is lower PCIe bandwidth and GPU usage.

The only positive change I’ve noticed with 570.133.07 is lower PCIe bandwidth and GPU usage.

I also see less usage. But since the update the gpu and pcie are jumping constantly between all the different powerlevels (from lowest to highest). So my guess is that this is more a result of the gpu and pcie running on a higher frequency on average and not of less data being transferred.

Same issue with the latest Nvidia drivers 570.133.07.
When I connect external monitor to USB-C than KDE freeze in X11.

In the 550xx branch I didn’t observe this issue.

Any suggestions?

Retried the newest NVIDIA Open Beta drivers on Arch 570.133.07.

No luck. Still the same issue. Some applications started with Optimus prime (prime-run) freeze after a few minutes for me when displayed on external screens.

Using only NVIDIA drivers and not the internal AMD-GPU on my notebook is no option, because the cooling fan will be active 24/7.

I reverted to the 550 branch. Works nicely. Maybe It would be helpful to identify with what version the errors were introduced. 550.144.03 works fine.

I am using these packages from Arch AUR for a working setup:

Driver:

Utils:

NVIDIA: It’s absolutely sad that you made billions with AI and can’t hire a single guy to properly do QA for the absolute basic features of your product.

1 Like

Moreover, they know how to reproduce this discussed issue, but still not found any solution yet. I think, they just wait for us to surrender and pass over this problem.

1 Like

Just tried latest beta 575.51.02 with proprietary kernel modules and it performs much better, regarding discussed freezes. But I had to set options nvidia NVreg_EnableGpuFirmware=0 to get KDE booted.
Despite of this glxgears/vkcube resizing test with PRIME offload shows almost no freezes. So I think that there is some progress in fixing annoying bug. And there is some interesting words in release notes:

Fixed a bug that prevented PRIME Render Offload from working correctly when using NVIDIA GPUs as both the render offload source and the render offload sink.

Hi,

My solution is to switch dGPU only mode. And do not use intel gpu and it looks good. This is only working solution for me.

dGPU draws much more power. :-(
With NVidia drivers performing much worse, I switched to using only Intel iGPU and running PRIME applications on dGPU on demand. My laptop is cool and quiet in this setup.