[clutter] Add a CLUTTER_PAINT debug option to enable continous redrawing



commit f8d808f140a4fe84e3002ee5935d4b8317779c9d
Author: Neil Roberts <neil linux intel com>
Date:   Fri Sep 23 15:12:44 2011 +0100

    Add a CLUTTER_PAINT debug option to enable continous redrawing
    
    When testing the performance of an application, it's often useful to
    force it to continuously redraw instead of going idle to help measure
    the frame rate. This just adds a CLUTTER_PAINT=continuous-redraw which
    causes the master clock to queue a redraw on all of the stages
    just before it prepares its source.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    Reviewed-by: Emmanuele Bassi <ebassi linux intel com>

 clutter/clutter-debug.h        |    3 ++-
 clutter/clutter-main.c         |    3 ++-
 clutter/clutter-master-clock.c |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-debug.h b/clutter/clutter-debug.h
index 75263fd..f4a9bf8 100644
--- a/clutter/clutter-debug.h
+++ b/clutter/clutter-debug.h
@@ -41,7 +41,8 @@ typedef enum {
   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_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
+  CLUTTER_DEBUG_CONTINUOUS_REDRAW       = 1 << 6
 } ClutterDrawDebugFlag;
 
 #ifdef CLUTTER_ENABLE_DEBUG
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 7a2cdcd..105b4ac 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -183,7 +183,8 @@ static const GDebugKey clutter_paint_debug_keys[] = {
   { "redraws", CLUTTER_DEBUG_REDRAWS },
   { "paint-volumes", CLUTTER_DEBUG_PAINT_VOLUMES },
   { "disable-culling", CLUTTER_DEBUG_DISABLE_CULLING },
-  { "disable-offscreen-redirect", CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT }
+  { "disable-offscreen-redirect", CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT },
+  { "continuous-redraw", CLUTTER_DEBUG_CONTINUOUS_REDRAW }
 };
 
 #ifdef CLUTTER_ENABLE_PROFILE
diff --git a/clutter/clutter-master-clock.c b/clutter/clutter-master-clock.c
index 1d67924..ce8d70b 100644
--- a/clutter/clutter-master-clock.c
+++ b/clutter/clutter-master-clock.c
@@ -277,6 +277,20 @@ clutter_clock_prepare (GSource *source,
   int delay;
 
   clutter_threads_enter ();
+
+  if (G_UNLIKELY (clutter_paint_debug_flags &
+                  CLUTTER_DEBUG_CONTINUOUS_REDRAW))
+    {
+      ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
+      const GSList *stages, *l;
+
+      stages = clutter_stage_manager_peek_stages (stage_manager);
+
+      /* Queue a full redraw on all of the stages */
+      for (l = stages; l != NULL; l = l->next)
+        clutter_actor_queue_redraw (l->data);
+    }
+
   delay = master_clock_next_frame_delay (master_clock);
   clutter_threads_leave ();
 



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