[client] main: improve frame rate sync lock with the guest

If the guest is not sending frames at a constant rate, the minimum FPS
timeout may expire drawing an additional frame. This change calculates
the average ups frame time over the past 100ms and adds this to the
timeout value allowing this value to be dynamic.
This commit is contained in:
Geoffrey McRae
2021-07-20 15:37:51 +10:00
parent b877bab48f
commit 3c0ebd54ec
2 changed files with 16 additions and 9 deletions

View File

@@ -104,7 +104,7 @@ struct AppState
RingBuffer renderTimings;
RingBuffer frameTimings;
atomic_uint_least64_t renderCount, frameCount;
atomic_uint_least64_t renderCount, frameCount, upsTime;
_Atomic(float) fps, ups;
uint64_t resizeTimeout;