Question How to get around the Microsoft DP unplug bug

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
This is a bug that's been around for over 10 years and MS refuses to fix it, anyone that has used DP probably knows about it. When you turn off or switch inputs on a monitor plugged into DP, Windows will treat it as if it's been completely disconnected, and it will shuffle windows all over the place and make a huge mess.

So my current home setup is as follows, 2 4k monitors plugged into a GPU via hdmi. The primary one goes through a KVM. Oddly enough Linux seems to have the same issue but with HDMI so it was affecting the second (top) monitor, but I found a dongle on Amazon that fixed the issue. Unfortunately they don't seem to make DP versions of it. It needs to have an in and an out, there's some but they only have an in. Not sure how that's suppose to work if you can't plug a monitor in it.

So anyway, this setup works. Where things break down is when I need to use my work machine. So the work machine has VGA, DVI, and 2x DP. No HDMI. So the VGA is primary monitor that is a separate side monitor, and the DVI is another side monitor. The first DP uses a DP to HDMI adapter and connects to the KVM, and the 2nd DP connects straight to the top monitor via DP. This is where things break down. When I turn off the top monitor, or even switch input back to HDMI at end of shift, it will shuffle all my windows all over the place. So to try to solve that I used another DP to HDMI adapter and connected it to the monitor's second HDMI input. This was working for a little while, but then it started acting up. All my monitors would turn black and start going haywire, and that one would stop detecting anything from the PC and switch to my personal HDMI one. I kept trying to switch the input but it would just go back. I would end up having to unplug the DP to HDMI adapter and plug it back in and just mess around with it until it recognizes again, and of course at this point my windows are thrown all over the place on my work machine. So that idea's out. Went back to straight DP. But now I'm back to square one, where when I work from home I can't turn off the top monitor, or switch input, without it messing up the work machine.

Is there any solutions to this problem? It's super frustrating. I've just kind of been living with it while trying stuff but I'm at my wits end I just want to make it work properly.

Is there anything on the software side in Windows I can do?
 
  • Like
Reactions: Leeea

bba-tcg

Senior member
Apr 8, 2010
753
402
136
computerguyonline.net
Reading this got me to thinking about how I used to have this problem, but don't anymore. I used to have a GTX 970 connected to a 4k monitor with a DP cable and Windows did this every time I turned the screen off. I never could find a solution that worked. I even quit arranging the icons on the screen because whenever I turned the screen back on, Windows had arranged them along the top left. After I upgraded that system to a RTX 2080, Windows quit doing the unplug/replug thing. Occassionally, a driver update would trigger the sound the unplug would cause, but it quit doing the icon rearrange. I now have that screen connected to another machine that still has a GTX 960, with a DP cable and it does not exhibit that behavior.

TL;DR I know what I said really didn't help your issue. But, I really do understand the frustration. I can only suggest trying a different model graphics adapter and/or looking for DP cables that don't have whatever line it is that Windows uses to detect the disconnect (I feel sure that at some point I changed cables w/o any conscious intent).
 

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
Hmm so wonder if it's a GPU/driver thing. Not that it really helps my case though since it's not like I can just keep trying different GPUs until I find one with better drivers. Especially since this is a low profile PC so options are very limited.

It's too bad they don't make the dongles for DP like they do for HDMI, since that's what solved my issue on my personal machine. For some reason Linux was doing it with HDMI. Kind of annoying they would introduce that bug in Linux and especially with HDMI.
 

mnewsham

Lifer
Oct 2, 2010
14,539
428
136
This has been covered a few times over the years
From a reddit thread from 3-4 years ago an L2 tech support response from Nvidia said the following
You are absolutely correct in that this is indeed due to hot-plug event. This is actually the expected behavior due to the DisplayPort specification. Unlike HDMI and DVI connections the DisplayPort connection will report a hot-unplug event when the display is powered OFF, and this hot-unplug event will remove the display completely from topology. Another word when the DisplayPort display is powered OFF then it is completely removed from the OS. As you power the display ON, it triggers a hot-plug event again and then the display is re-enumerated and added back to topology. The re-enumerating of the display triggers the OS to re-arrange the desktop icons, and this is normal behavior of the OS when ever a display is removed and plugged back in. With HDMI/DVI connection, even if the display is powered OFF the display is actually still part of the toplogy, so there is no hot-plug event triggered. In fact, if you physically disconnect the HDMI/DVI connection from the PC then it would likely trigger the same behavior, since physically disconnecting and then re-plug the HDMI/DVI will trigger the same hot-plug event. This is completely between the monitor and the OS and we have no control over.
 
  • Like
Reactions: Leeea

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
This seems crazy that they actually purposely designed it this way. It's a very poor not well thought out design. Simply turning off a monitor absolutely should not be triggering a hot plug event. Or even switching the input (which seems to do it too).

I wonder if something like this would solve the issue:


Or this (same thing but also converts to HDMI)


Downside is this kind of brings me back to the setup that was randomly messing up. Was using a DP to HDMI adapter, and randomly the screen would just drop out and everything would go all nuts. It seems DP is very sensitive in general. At work our monitors randomly flicker and do weird stuff, like if someone walks too close etc. The flickers don't cause the reshuffling though, but occasionally the screens don't come back on their own then you have no choice to restart it. So introducing these adapters seems to aggravate the issue.

I did find a registry hack that involves setting the "virtual" monitor to 4k, maybe I will have to experiment with that. I think that will only work for very specific cases though like if you lose only 1 monitor. Not sure what happens if you lose two.
 

samboy

Senior member
Aug 17, 2002
223
94
101
I have exactly the same problem with 2x4k Samsung monitors with DP. Whenever the monitors go to sleep (which is a good practice to power them down when not in use) all the windows get shuffled on wake up.

Like OP, I'm amazed that things were designed this way. I've done a lot of googling on the topic; many folks with the same problem but nothing has worked for me. Microsoft doesn't seem to care about the problem.

This is a pretty basic problem and quite annoying........

Hope someone here can recommend a solution?
 

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
If your entire setup uses DP, it might work to put two KVM switches in between. I know for my first 4k the KVM seems to stop it from happening, but I do have a DP to HDMI adapter involved (kvm is HDMI). The issue is when I tried to use a HDMI to DP adapter for the 2nd monitor, it did not work for very long. I thought I had it, but nope. Started to cause issues after a while.

But yeah it's ridiculous that all this is even necessary, to me this is a serious software issue that should be easy to solve from the code point of view.
 

mnewsham

Lifer
Oct 2, 2010
14,539
428
136
But yeah it's ridiculous that all this is even necessary, to me this is a serious software issue that should be easy to solve from the code point of view.
Since it has to do with a hot-plug event, I don't think there IS a simple way to fix it, it was designed to behave that way, and to change it from the code side would be to treat hot-plug events in a non-standard manner.

I'm just guessing, but if it WERE an easy simple fix, it'd be fixed by now.
 

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
Since it has to do with a hot-plug event, I don't think there IS a simple way to fix it, it was designed to behave that way, and to change it from the code side would be to treat hot-plug events in a non-standard manner.

I'm just guessing, but if it WERE an easy simple fix, it'd be fixed by now.

I'm thinking more software within the monitor/DP spec itself, ex: at the monitor end. The standard should be to ensure a hot plug event does not happen unless it's actually unplugged.
 

Leeea

Diamond Member
Apr 3, 2020
3,799
5,565
136
I hate this behavior.

I see it with 3 different monitors and two TVs* on both vega56 and 6900xt. I think it is a win10 issue.

DesktopOK can fix your icons after you switch back, but it will not fix the windows.


*I typically use a DP to HDMI adaptor
 

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
Issue with windows 7 too, and even somewhat Linux. My Linux Mint system was doing it even with HDMI, which is odd because even Windows does not do it with HDMI. I was able to find a HDMI pass through ghost adapter that emulates the monitor always being turned on, downside is it does introduce some latency. When I move a window I can actually see the lag between the top and bottom monitor.

I just ordered another DP to HDMI converter as well as a HDMI switch, I'm hoping this might fix it for both the Linux and Windows machine. Failing that I will get a KVM, as I know it works since I'm using it for the primary monitor.
 

iCyborg

Golden Member
Aug 8, 2008
1,342
59
91
Like mnewsham said, it's really DP spec behavior where power off is treated as hotplug.
Not sure about NV, but on AMD FirePro cards they have EDID emulation thingy where you can force a monitor on a certain connector, in the sense that GPU driver always reports to OS that a particular monitor is there. Even if you physically unplug it, so if you did want to connect a new monitor, you'd need to "unforce" it.

This bugs me too, but not enough to consider a workstation card. It was meant for those big multi-display walls - if you think 2 displays is bad, imagine having 24 of them and you trip over some wire and everything goes to hell :)
 

Red Squirrel

No Lifer
May 24, 2003
69,723
13,342
126
www.betteroff.ca
Yeah it's retarded that this is part of spec, don't know what purpose it tries to solve, it's just a huge annoyance.

My order came in the other day and realized I accidentally ordered a HDMI splitter instead of a switch... so I'm back to square one lol. I think I will just order a KVM, the same model I use for the primary, since at least I know it works for stopping this madness as it solved the issue for the primary monitor so may as well just get the same model for the second even if it costs a bit more than a simple HDMI switch. It's a TESmart 4k KVM, pretty decent as a KVM too, it's hard to find a good KVM these days as most of them are VGA and PS/2.
 

Tup3x

Golden Member
Dec 31, 2016
1,227
1,323
136
It's possible to fix that from registry. Can't help right now (I think I had saved the solution on my PC though - on my phone at the moment) but it should be possible to google the solution.

It involves changing the default resolution/desktop size so that it matches the display resolution.
 

Tup3x

Golden Member
Dec 31, 2016
1,227
1,323
136
This might finally get fixed.
In the leaked Windows 11 build, there's an option that allows the OS to remember each window location based on the monitor connection. This means that if you leave a bunch of windows opened on both monitors, once you re-connect a display or when you wake up the PC. This should potentially fix the issue of moving random windows or tabs or cramming up all the opened apps on one of the monitors.

Additionally, once you disconnect one of your monitors, instead of moving the program to the still plugged monitor, the OS will minimize the app to the tray.