From b77cb09bac57e17c5b05cd5dff7affe65272dae3 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Mon, 13 Dec 2021 18:41:34 +0800 Subject: [PATCH] clutter/frame-clock: Make SYNC_DELAY_FALLBACK a fraction This won't change anything for 60Hz displays but higher refresh rate users will benefit. Using Nvidia EGLStreams on a 240Hz monitor for example (refresh interval ~4.1ms), the maximum render time allowed before dropping to 120Hz is now 3.6ms whereas it was previously 2.1ms. Part-of: --- clutter/clutter/clutter-frame-clock.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index df359e573..24e0ec8a2 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -45,10 +45,7 @@ typedef struct _EstimateQueue int next_index; } EstimateQueue; -/* When heuristic render time is off, - * wait 2ms after vblank before starting to draw next frame. - */ -#define SYNC_DELAY_FALLBACK_US ms2us (2) +#define SYNC_DELAY_FALLBACK_FRACTION 0.875 typedef struct _ClutterFrameListener { @@ -319,7 +316,7 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock) if (!frame_clock->got_measurements_last_frame || G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME)) - return refresh_interval_us - SYNC_DELAY_FALLBACK_US; + return refresh_interval_us * SYNC_DELAY_FALLBACK_FRACTION; for (i = 0; i < ESTIMATE_QUEUE_LENGTH; ++i) {