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

Add support for fractional refresh rates #109

Open paperman5 opened 1 week ago

paperman5 commented 1 week ago

I am curious if it would be possible to add support for non-integer (i.e. fractional) display refresh rates. It seems possible as the DISPLAYCONFIG_VIDEO_SIGNAL_INFO set here allows rational vsync/hsync values. Would it be possible to allow the user to specify a numerator/denominator in the options.txt as a custom display setting? Maybe if there are 4 values on the line instead of 3, the last 2 values are interpreted as a numerator/denominator pair.

I can attempt to add this myself, but I can't quite figure out the dependencies for this project as I'm not familiar with writing drivers. If someone could give some quick tips for building the project that would be helpful.

Thanks for your hard work on this project, this is really cool tech!

bud3699 commented 1 week ago

Theoretically it would be possible. We can change the integer calculations to floats and just see that way

paperman5 commented 1 week ago

Based on my understanding of the docs it looks like it has to be a rational number with integer numerator/denominator, but I am not well versed with this stuff.

paperman5 commented 1 week ago

Ok, I have managed to get the dependencies resolved by following this guide. In order to get the driver to build, I had to add

#define IDDCX_VERSION_MAJOR 1
#define IDDCX_VERSION_MINOR 9
#define IDDCX_MINIMUM_VERSION_REQUIRED 9

to Driver.h, then add /fd SHA256 to the additional options under Project > IddSampleDriver Properties > Driver Signing > Command Line. After that the driver will build, but following the installation instructions from the README with my newly built driver results in a code 31 error in the device manager. Installing the latest driver from the releases page works fine, so I'm sure I'm doing something wrong in the build process. Any tips?

EDIT: As I was typing this I thought my definitions might be wrong, so I changed it to

#define IDDCX_VERSION_MAJOR 1
#define IDDCX_VERSION_MINOR 4

and it works fine. I will try adding the fractional refresh feature.