itsmikethetech / Virtual-Display-Driver

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

Support fractional refresh rates in display modes #111

Open paperman5 opened 1 week ago

paperman5 commented 1 week ago

This PR adds support for fractional display refresh rates for the virtual display. As shown here, the DISPLAYCONFIG_VIDEO_SIGNAL_INFO's hSyncFreq and vSyncFreq can be any rational number (integer numerator/denominator pairs). I set these appropriately in the driver code, as well as allowing the user to specify a numerator/denominator pair in option.txt as they would when adding a new display resolution. For example,

1920, 1080, 60000, 1001

in option.txt would set up a 1920x1080 59.94Hz display option.

This change works fine in my testing (Windows 10 19045), but I don't have a Windows 11 PC or an HDR display to test with so I only changed the Non-HDR driver code. I can do the same change for the HDR driver code but I can't test it. This is also my first time working with driver code so it may be possible I missed something important - please let me know if that is the case.

Closes #109.

itsmikethetech commented 2 days ago

Great work! Will implement ASAP!