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

@ -410,8 +410,8 @@
<option value="enabled">Enabled</option>
</select>
<div class="form-text">
Improves capture latency during mouse movement.<br />
Enabling this may prevent the client's FPS from exceeding the host monitor's active refresh rate.
Improves capture latency/smoothness during mouse movement.<br />
Disable if you encounter any VSync-related issues.
</div>
</div>
<div class="mb-3" class="config-page" v-if="platform === 'linux'">
@ -843,7 +843,7 @@
this.config.key_rightalt_to_key_win || "disabled";
this.config.gamepad = this.config.gamepad || "x360";
this.config.upnp = this.config.upnp || "disabled";
this.config.dwmflush = this.config.dwmflush || "disabled";
this.config.dwmflush = this.config.dwmflush || "enabled";
this.config.min_log_level = this.config.min_log_level || 2;
this.config.origin_pin_allowed =
this.config.origin_pin_allowed || "pc";