[mutter] clutter/frame-clock: Make SYNC_DELAY_FALLBACK a fraction



commit b77cb09bac57e17c5b05cd5dff7affe65272dae3
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Mon Dec 13 18:41:34 2021 +0800

    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>

 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 df359e573a..24e0ec8a22 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)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]