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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2158>
This commit is contained in:
Daniel van Vugt 2021-12-13 18:41:34 +08:00 committed by Marge Bot
parent f48b3b489b
commit b77cb09bac

View File

@ -45,10 +45,7 @@ typedef struct _EstimateQueue
int next_index; int next_index;
} EstimateQueue; } EstimateQueue;
/* When heuristic render time is off, #define SYNC_DELAY_FALLBACK_FRACTION 0.875
* wait 2ms after vblank before starting to draw next frame.
*/
#define SYNC_DELAY_FALLBACK_US ms2us (2)
typedef struct _ClutterFrameListener 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 || if (!frame_clock->got_measurements_last_frame ||
G_UNLIKELY (clutter_paint_debug_flags & G_UNLIKELY (clutter_paint_debug_flags &
CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME)) 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) for (i = 0; i < ESTIMATE_QUEUE_LENGTH; ++i)
{ {