platform/windows: change dwmflush default, add autodetection

On each re/init, query the active monitor refresh rate via
DwmGetCompositionTimingInfo. If the client requested framerate exceeds
the host monitor refresh, automatically disable DwmFlush.

This avoids the problem by which DwmFlush would constrain the client
FPS if the host monitor runs at a lower refresh rate, thus allowing
the feature to be enabled by default.

If there are other issues caused by DwmFlush for certain systems,
it can still be disabled via configuration.
This commit is contained in:
Conn O'Griofa 2022-05-20 16:25:09 +01:00
commit 2d969c2ccc
5 changed files with 29 additions and 11 deletions

View file

@ -339,11 +339,12 @@ dwmflush
Description
Invoke DwmFlush() to sync screen capture to the Windows presentation interval.
.. Caution:: Applies to Windows only. Alleviates visual stuttering during mouse movement, but causes the capture
rate to be limited to the host monitor's currently active refresh rate.
.. Caution:: Applies to Windows only. Alleviates visual stuttering during mouse movement.
If enabled, this feature will automatically deactivate if the client framerate exceeds
the host monitor's current refresh rate.
Default
``disabled``
``enabled``
Examples