stage: Make the redraw_count a stage counter

We don't care about redraws issued on stages that are not currently
being repainted.
This commit is contained in:
Emmanuele Bassi 2011-02-18 14:38:54 +00:00
parent 4635c8f9fd
commit 28b0f8b938
2 changed files with 19 additions and 9 deletions

View File

@ -144,8 +144,6 @@ struct _ClutterMainContext
ClutterEvent *current_event; ClutterEvent *current_event;
guint32 last_event_time; guint32 last_event_time;
gulong redraw_count;
/* list of repaint functions installed through /* list of repaint functions installed through
* clutter_threads_add_repaint_func() * clutter_threads_add_repaint_func()
*/ */

View File

@ -140,6 +140,10 @@ struct _ClutterStagePrivate
GTimer *fps_timer; GTimer *fps_timer;
gint32 timer_n_frames; gint32 timer_n_frames;
#ifdef CLUTTER_ENABLE_DEBUG
gulong redraw_count;
#endif /* CLUTTER_ENABLE_DEBUG */
guint relayout_pending : 1; guint relayout_pending : 1;
guint redraw_pending : 1; guint redraw_pending : 1;
guint is_fullscreen : 1; guint is_fullscreen : 1;
@ -883,13 +887,15 @@ _clutter_stage_do_update (ClutterStage *stage)
/* reset the guard, so that new redraws are possible */ /* reset the guard, so that new redraws are possible */
priv->redraw_pending = FALSE; priv->redraw_pending = FALSE;
if (CLUTTER_CONTEXT ()->redraw_count > 0) #ifdef CLUTTER_ENABLE_DEBUG
if (priv->redraw_count > 0)
{ {
CLUTTER_NOTE (SCHEDULER, "Queued %lu redraws during the last cycle", CLUTTER_NOTE (SCHEDULER, "Queued %lu redraws during the last cycle",
CLUTTER_CONTEXT ()->redraw_count); priv->redraw_count);
CLUTTER_CONTEXT ()->redraw_count = 0; priv->redraw_count = 0;
} }
#endif /* CLUTTER_ENABLE_DEBUG */
return TRUE; return TRUE;
} }
@ -3240,20 +3246,26 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
CLUTTER_NOTE (PAINT, "Redraw request number %lu",
CLUTTER_CONTEXT ()->redraw_count + 1);
if (!priv->redraw_pending) if (!priv->redraw_pending)
{ {
ClutterMasterClock *master_clock; ClutterMasterClock *master_clock;
CLUTTER_NOTE (PAINT, "First redraw request");
priv->redraw_pending = TRUE; priv->redraw_pending = TRUE;
master_clock = _clutter_master_clock_get_default (); master_clock = _clutter_master_clock_get_default ();
_clutter_master_clock_start_running (master_clock); _clutter_master_clock_start_running (master_clock);
} }
#ifdef CLUTTER_ENABLE_DEBUG
else else
CLUTTER_CONTEXT ()->redraw_count += 1; {
CLUTTER_NOTE (PAINT, "Redraw request number %lu",
priv->redraw_count + 1);
priv->redraw_count += 1;
}
#endif /* CLUTTER_ENABLE_DEBUG */
/* We have an optimization in _clutter_do_pick to detect when the /* We have an optimization in _clutter_do_pick to detect when the
* scene is static so we can cache a full, un-clipped pick buffer to * scene is static so we can cache a full, un-clipped pick buffer to