[mutter] clutter: Add an lg command to set max render time constant



commit f55c9af61856dcf6989064113e61e15fbedf9618
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Nov 28 22:15:02 2020 +0300

    clutter: Add an lg command to set max render time constant
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>

 clutter/clutter/clutter-debug.h       |  1 +
 clutter/clutter/clutter-frame-clock.c |  7 +------
 clutter/clutter/clutter-main.c        | 11 +++++++++++
 clutter/clutter/clutter-main.h        |  3 +++
 4 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/clutter/clutter/clutter-debug.h b/clutter/clutter/clutter-debug.h
index 76b8505cb0..677bed1079 100644
--- a/clutter/clutter/clutter-debug.h
+++ b/clutter/clutter/clutter-debug.h
@@ -41,6 +41,7 @@ G_BEGIN_DECLS
 extern guint clutter_debug_flags;
 extern guint clutter_pick_debug_flags;
 extern guint clutter_paint_debug_flags;
+extern int clutter_max_render_time_constant_us;
 
 void    _clutter_debug_messagev         (const char *format,
                                          va_list     var_args) G_GNUC_PRINTF (1, 0);
diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c
index 58ec885e03..504e47bf5c 100644
--- a/clutter/clutter/clutter-frame-clock.c
+++ b/clutter/clutter/clutter-frame-clock.c
@@ -50,11 +50,6 @@ typedef struct _EstimateQueue
  */
 #define SYNC_DELAY_FALLBACK_US ms2us (2)
 
-/* A constant added to heuristic max render time to account for variations
- * in the estimates.
- */
-#define MAX_RENDER_TIME_CONSTANT_US ms2us (2)
-
 typedef struct _ClutterFrameListener
 {
   const ClutterFrameListenerIface *iface;
@@ -340,7 +335,7 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
     max_dispatch_to_swap_us +
     MAX (max_swap_to_rendering_done_us, max_swap_to_flip_us) +
     frame_clock->vblank_duration_us +
-    MAX_RENDER_TIME_CONSTANT_US;
+    clutter_max_render_time_constant_us;
 
   max_render_time_us = CLAMP (max_render_time_us, 0, refresh_interval_us);
 
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index ddde16fad4..fa206b3073 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -95,6 +95,11 @@ guint clutter_debug_flags       = 0;
 guint clutter_paint_debug_flags = 0;
 guint clutter_pick_debug_flags  = 0;
 
+/* A constant added to heuristic max render time to account for variations
+ * in the estimates.
+ */
+int clutter_max_render_time_constant_us = 2000;
+
 #ifdef CLUTTER_ENABLE_DEBUG
 static const GDebugKey clutter_debug_keys[] = {
   { "misc", CLUTTER_DEBUG_MISC },
@@ -2275,6 +2280,12 @@ clutter_remove_debug_flags (ClutterDebugFlag     debug_flags,
   clutter_pick_debug_flags &= ~pick_flags;
 }
 
+void
+clutter_debug_set_max_render_time_constant (int max_render_time_constant_us)
+{
+  clutter_max_render_time_constant_us = max_render_time_constant_us;
+}
+
 void
 _clutter_set_sync_to_vblank (gboolean sync_to_vblank)
 {
diff --git a/clutter/clutter/clutter-main.h b/clutter/clutter/clutter-main.h
index 35931bb516..a0ee83b3e0 100644
--- a/clutter/clutter/clutter-main.h
+++ b/clutter/clutter/clutter-main.h
@@ -198,6 +198,9 @@ void                    clutter_remove_debug_flags              (ClutterDebugFla
                                                                  ClutterDrawDebugFlag draw_flags,
                                                                  ClutterPickDebugFlag pick_flags);
 
+CLUTTER_EXPORT
+void                    clutter_debug_set_max_render_time_constant (int max_render_time_constant_us);
+
 G_END_DECLS
 
 #endif /* _CLUTTER_MAIN_H__ */


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