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>
This commit is contained in:
Neil Roberts 2011-09-23 15:12:44 +01:00
parent e08df14d42
commit f8d808f140
3 changed files with 18 additions and 2 deletions

View File

@ -41,7 +41,8 @@ typedef enum {
CLUTTER_DEBUG_REDRAWS = 1 << 2, CLUTTER_DEBUG_REDRAWS = 1 << 2,
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3, CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4, 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; } ClutterDrawDebugFlag;
#ifdef CLUTTER_ENABLE_DEBUG #ifdef CLUTTER_ENABLE_DEBUG

View File

@ -183,7 +183,8 @@ static const GDebugKey clutter_paint_debug_keys[] = {
{ "redraws", CLUTTER_DEBUG_REDRAWS }, { "redraws", CLUTTER_DEBUG_REDRAWS },
{ "paint-volumes", CLUTTER_DEBUG_PAINT_VOLUMES }, { "paint-volumes", CLUTTER_DEBUG_PAINT_VOLUMES },
{ "disable-culling", CLUTTER_DEBUG_DISABLE_CULLING }, { "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 #ifdef CLUTTER_ENABLE_PROFILE

View File

@ -277,6 +277,20 @@ clutter_clock_prepare (GSource *source,
int delay; int delay;
clutter_threads_enter (); 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); delay = master_clock_next_frame_delay (master_clock);
clutter_threads_leave (); clutter_threads_leave ();