Add a CLUTTER_PAINT debug option to enable continous redrawing
authorNeil Roberts <neil@linux.intel.com>
Fri, 23 Sep 2011 14:12:44 +0000 (15:12 +0100)
committerNeil Roberts <neil@linux.intel.com>
Fri, 23 Sep 2011 14:31:50 +0000 (15:31 +0100)
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
clutter/clutter-main.c
clutter/clutter-master-clock.c

index 75263fd..f4a9bf8 100644 (file)
@@ -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
index 7a2cdcd..105b4ac 100644 (file)
@@ -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
index 1d67924..ce8d70b 100644 (file)
@@ -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 ();