How to disable display auto-detection on X.Org

How can I prevent the NVIDIA driver from auto-detecting connected displays on X.Org?

I have an AMD Ryzen system with an NVIDIA GeForce RTX 2060 Super. I’m running Gentoo Linux (amd64), Kernel 5.4.18, X.Org server 1.20.6, NVIDIA driver 440.44-r1, KDE Plasma 5.17.4. I have two displays connected via DP-to-HDMI adapters, the driver is configured to create a virtual desktop spanning over both displays.

Whenever I resume the system from sleep or hit a key to wake up the displays from DPMS sleep, my display configuration gets messed up. The behavior is somewhat random, one of the following things will happen:

  • both displays stay dark, I have to restart X using SSH
  • only one display comes online, the virtual desktop is reduced to that display
  • both displays come online, but in clone mode rather than spanning mode
  • both displays come online, but all windows have moved to either the right or left display
  • both displays come online, but one shows a clean new desktop (no icons, changed background, etc.)
  • ...

My guess is that there’s some race condition going on regarding the DP-to-HDMI adapters (which are active, i.e. they contain chips that do the conversion). I tried to disable KDE’s KScreen screen management service, but this did not change anything.

Thus my question: how can I prevent the driver from trying to guess which displays are connected and just stick to what’s configured?
xorg.conf.txt (1.05 KB)

No one?

It seems this is what I was looking for:

Option "ConnectedMonitor" "..."