Fullscreen goes across monitors after monitors reconnect

I’m running a two-monitor setup. Normally when I put a program into fullscreen mode, it covers just my left-hand monitor, or sometimes the monitor that the original window was in. That’s the way I’d like it to be. However, sometimes when the monitors disconnect and then reconnect (e.g. after coming out of a screensaver that turns the monitors off, or after switching my KVM switch from my laptop back to my desktop), putting a program into fullscreen mode makes the image go across both monitors.

So far, I’ve seen this happen with several games (Dead Cells, Portal 2, Overcooked 2), as well as YouTube videos in Firefox. I can reproduce the issue fairly reliably by letting my screensaver run until both monitors power down/go into some kind of standby mode (their indicator lights turn orange instead of blue), then hit my keyboard to end the screensaver.

I’ve compared the output of xset -q, xrandr --verbose and xrandr --listmonitors both when the issue is present and when it is not, but the only differences I’ve seen have been a very slight difference in the physical width/height reported of the larger monitor (a difference of a few millimeters) and a difference of 2-3 degrees in the GPU temperature. I was hoping I could find some command-line tool that would show, say, a different bounding box when the issue is present and therefore give an indication of where the issue is coming from, but so far no luck.

Any idea what is going wrong here and how I can fix it? I’m happy to run other tests and supply more information as needed. Also, if there’s a way I can prove that this is the fault of some other component (e.g. SDL rather than the NVIDIA driver), I’d be glad to do that and report the issue to the relevant forum.

System info:

  • Distro: Arch Linux
  • uname -a output: Linux atlantis 5.4.79-1-lts #1 SMP Sun, 22 Nov 2020 14:22:21 +0000 x86_64 GNU/Linux
  • GPU: GeForce GTX 950
  • NVIDIA driver version: 455.45.01 (specifically, the Arch Linux package nvidia-lts at version 1:455.45.01-2)
  • Monitors: Acer VG270U (this is the primary monitor) with resolution 2560x1440, Acer G235H with resolution 1920x1080
    ** the VG270U is output DP-4 in the various X output files below, and the G235H is DP-2
    ** These both have a StarTech SV231DPDDUA2 KVM switch between them and the GPU, and the G235H also has a DVI to DisplayPort connector between it and the KVM.
  • xorg.conf.txt (1.8 KB)
  • xset -q: xset-q_output.txt (1.1 KB)
  • xrandr --listmonitors:
    ** Monitors: 2
    ** 0: +*DP-4 2560/597x1440/336+0+0 DP-4
    ** 1: +DP-2 1920/510x1080/287+2560+360 DP-2
  • xrandr --verbose: xrandr_verbose_output.txt (14.1 KB)
  • Please let me know whatever else I can provide.

The problem disappeared after I switched away from the lts version of the kernel (as well as the associated lts version of the nvidia package) and upgraded the package to the newest version.

Hmm, actually it’s still happening, but seemingly less frequently. When the screensaver comes on and turns off my monitors, it doesn’t seem to happen, but it sometimes does when I use the KVM switch to switch away to another system for a while.

Rather sounds like the KVM switch is faking some edid in the switched/off state and does that incorrectly so the WM’s monitor manager gets confused.