haimgel / display-switch

Turn a $30 USB switch into a full-featured multi-monitor KVM switch
https://haim.dev/posts/2020-07-28-dual-monitor-kvm/
MIT License
2.83k stars 110 forks source link

Frame rate change #81

Open Tabiskabis opened 2 years ago

Tabiskabis commented 2 years ago

I have 2 Dell S2721DGF monitors connected to a Windows PC via HDMI at 144 Hz and a Mac laptop via DP at 120 Hz. For the last few months, I've used a script for the Dell Display Manager application to switch inputs, and the refresh rates change to their respective max, as expected.

Every second or third time when i let display-switch go from the PC to the laptop input, the refresh rate of one of the screens (always the same one) drops to 60 Hz and it takes a cable reconnect for the 120Hz to be recognized as valid refresh rate again.

I'll just work around the issue by running the old script on the PC, but i'd love to get rid of that, as for some reason it's much slower in issuing the input switch command than display-switch is.

haimgel commented 2 years ago

I wonder if "much slower" part is relevant to reliability here... I guess the platform is Windows, correct?

Tabiskabis commented 2 years ago

Whoops, grave mistake in my original post, now corrected.

The issue only happens when switching from PC to Mac, where the Mac version of display-switch commands the monitors to switch to DP (on_usb_connect = "DisplayPort1").

I have not tried using on_usb_disconnect on the windows PC, as the goal for me is to easily switch to the MacBook even when i'm running a different/temporary OS on the PC

Tabiskabis commented 2 years ago

Update for that: seems to be a timing issue on MacOS (i'm still on Mojave). Issue solved by making on_usb_connect execute a script which issues the switch commands in parallel (using ddcctl). ddcctl -d 1 -i 15 & ddcctl -d 2 -i 15

Another update: it's definitely some timing issue. when the mac detects the first newly active monitor, a bunch of things happen before it starts actually sending signal to that screen. this reconfiguration takes about two seconds. if the second screen becomes available when the reconfiguration has already reached a certain phase, something will fail and the second screen will be signalled with 60Hz only.

So the issue can be avoided by switching monitor inputs very slowly, with a ca. 3 second delay between each monitor. Just kidding. obviously preferable is switching both monitors with as little delay as possible.