itsmikethetech / Virtual-Display-Driver

Add virtual monitors to your windows 10/11 device! Works with VR, OBS, Sunshine, and/or any desktop sharing software.
3.01k stars 125 forks source link

Display Resolution, orientation, and position reset after device reboot #30

Open DeeJanuz opened 8 months ago

DeeJanuz commented 8 months ago

As the title says. I'm attempting to use 4 virtual displays to use with virtual desktop and a VR headset. It works flawlessly except for the fact that after every reboot of the PC it resets the displays positions, orientation, and resolution to the base 640 x 480.

DeeJanuz commented 8 months ago

Actually, this appears to happen only if you install multiple drivers. If you use one driver and modify the options file to have the 1 replaced with a number between 1-5 then it works as expected, other than the fact that there is degraded performance on the monitors. (and causes terrible performance if you're using wallpaper engine)

zjoasan commented 6 months ago

It can be based that the "signal" to the virtual displays are based on a 640*480, which might set default to mulltiple displays to the same. I'm still learning about the driver, but it's on the "ToDo" list.

Cigam-HFden commented 5 months ago

In the option text I reduced it down to not have the resolution issue. So my option.txt is the first line as 1, then only one of the 1920x1080 listings (deleting the rest). Then I installed multiple drivers, because adjusting the first number in the txt file causes massive lag, but installing the multiple drivers is super smooth. This results in the multiple monitors keeping their resolution on reboot. Positionally they are horizontally all aligned on the right, but their order positions get randomized on reboots. Hope that helps some in the mean time. (I am also on Windows 10, not sure how windows 11 does with it)

Cigam-HFden commented 4 months ago

I figured out a solution that worked well for getting the monitors to keep position. Using the trick I mentioned before, having the option txt modified and adding multiple drivers you can then do the following steps to get a consistent layout on reboot.

First you will need this tool of DPedit, which lets you modify the location of each monitor via script: https://github.com/programmer2514/DPEdit

There is a gui version, but I was not able to get it to work, and the terminal version is better for scripts. With that downloaded you will need to see what monitor you need where. Easiest way is to arrange it in the windows settings close to how you want. Then in a terminal run: DPedit.exe /L

Which will list the monitors you have currently. Note the ones that have a position. Some may not, and those will not be ones to modify. Only the ones with position. Whatever monitor is the primary will have its upper left corner at 0 0 position. Any to the left or above will be negative. For mine I have 2 physical monitors duplicated screen so it only shows up as display 1 in the list but in the windows setting it shows up as 1|2. Then I have 5 virtual monitors.

My layout from a windows setting view was these numbers:

3 4 5 6 1 7

Because I wanted the primary at the bottom center. The display script for that was as such: (To get it to work upon each reboot I have a bat file that does this code line, but with the full path to the exe): DPEdit.exe 5 -1920 -1080 6 0 -1080 7 1920 -1080 8 -1920 0 1 0 0 9 1920 0

The numbers do not match the windows settings numbers because there were other nvidia displays that did not match, but otherwise the sequence matched. Note the negatives and positives to make it match based on where the primary is located. The script numbers looks like this:

5 6 7 8 1 9

I am using a valve index with steam vr and desktop plus: https://store.steampowered.com/app/1494460/Desktop/

With desktop plus there is a combined desktop mode which makes it easy to move all of the windows around and have it permanent in VR space. But if you were to do them separately then the numbers are also different. In the app though they essentially go in reverse order. They have them as these display numbers:

6 5 4 3 1 2

So to put them next to each other for my setup these are how the numbers for the displays match up: w = windows settings number d = dpedit number v = steam vr desktop plus number

w3=d5=v6 w4=d6=v5 w5=d7=v4 w6=d8=v3 w1=d1=v1 w7=d9=v2

To use the VR on reboot inside of steam vr you can goto advanced settings and manage addon, and have desktop plus start with steam vr. In windows you can do a win+r and goto shell:startup which will be the folder that you can add shortcuts to the bat file for your dpedit code and a steam vr shortcut. Then it will load both correctly on reboot.

If you have extra displays that you plugin you might have to adjust it. It is helpful to have a shortcut for that bat file on the desktop too or somewhere easy to get to so that if it doesnt fix it for some reason you can just run it again after the reboot finishes. Also allows you to have different layouts as different scripts that you can run however you like.

For me I also do not like windows grabbing the windows (to snap them) as I am dragging them across the monitors. So I also added this reg key to disable that boundary edge grab. It still allows for you to do the win+direction to snap, but the drag is so much easier with this off. Here is the page talking about it: https://superuser.com/a/1640496 and here is the reg code needed. You can run this in a bat file or the regedit console: reg add "HKCU\Control Panel\Mouse" /v DockTargetMouseWidth /t REG_DWORD /d 0

So far it is working great for me doing it that way. Hope this helps others who want to do it on a consistent basis.