[mutter] clutter: Add a flag to disable heuristic max render time



commit 565e34b4d22f6e67397a24094e0876f865e84a41
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Nov 28 16:46:03 2020 +0300

    clutter: Add a flag to disable heuristic max render time
    
    Debugging purposes: allows to check if frame drops are caused by
    heuristic max render time or if they are there even with the old
    behavior.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>

 clutter/clutter/clutter-frame-clock.c |  5 ++++-
 clutter/clutter/clutter-main.c        |  1 +
 clutter/clutter/clutter-main.h        | 19 ++++++++++---------
 3 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c
index 8289c0af8c..58ec885e03 100644
--- a/clutter/clutter/clutter-frame-clock.c
+++ b/clutter/clutter/clutter-frame-clock.c
@@ -19,6 +19,7 @@
 
 #include "clutter/clutter-frame-clock.h"
 
+#include "clutter/clutter-debug.h"
 #include "clutter/clutter-main.h"
 #include "clutter/clutter-private.h"
 #include "clutter/clutter-timeline-private.h"
@@ -307,7 +308,9 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
   refresh_interval_us =
     (int64_t) (0.5 + G_USEC_PER_SEC / frame_clock->refresh_rate);
 
-  if (!frame_clock->got_measurements_last_frame)
+  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;
 
   for (i = 0; i < ESTIMATE_QUEUE_LENGTH; ++i)
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index bbefd62d08..ddde16fad4 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -130,6 +130,7 @@ static const GDebugKey clutter_paint_debug_keys[] = {
   { "continuous-redraw", CLUTTER_DEBUG_CONTINUOUS_REDRAW },
   { "paint-deform-tiles", CLUTTER_DEBUG_PAINT_DEFORM_TILES },
   { "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
+  { "disable-dynamic-max-render-time", CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME },
 };
 
 gboolean
diff --git a/clutter/clutter/clutter-main.h b/clutter/clutter/clutter-main.h
index 74abc29a07..35931bb516 100644
--- a/clutter/clutter/clutter-main.h
+++ b/clutter/clutter/clutter-main.h
@@ -63,15 +63,16 @@ typedef enum
 
 typedef enum
 {
-  CLUTTER_DEBUG_DISABLE_SWAP_EVENTS        = 1 << 0,
-  CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS    = 1 << 1,
-  CLUTTER_DEBUG_REDRAWS                    = 1 << 2,
-  CLUTTER_DEBUG_PAINT_VOLUMES              = 1 << 3,
-  CLUTTER_DEBUG_DISABLE_CULLING            = 1 << 4,
-  CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
-  CLUTTER_DEBUG_CONTINUOUS_REDRAW          = 1 << 6,
-  CLUTTER_DEBUG_PAINT_DEFORM_TILES         = 1 << 7,
-  CLUTTER_DEBUG_PAINT_DAMAGE_REGION        = 1 << 8,
+  CLUTTER_DEBUG_DISABLE_SWAP_EVENTS             = 1 << 0,
+  CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS         = 1 << 1,
+  CLUTTER_DEBUG_REDRAWS                         = 1 << 2,
+  CLUTTER_DEBUG_PAINT_VOLUMES                   = 1 << 3,
+  CLUTTER_DEBUG_DISABLE_CULLING                 = 1 << 4,
+  CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT      = 1 << 5,
+  CLUTTER_DEBUG_CONTINUOUS_REDRAW               = 1 << 6,
+  CLUTTER_DEBUG_PAINT_DEFORM_TILES              = 1 << 7,
+  CLUTTER_DEBUG_PAINT_DAMAGE_REGION             = 1 << 8,
+  CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME = 1 << 9,
 } ClutterDrawDebugFlag;
 
 /**


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