#ifdef CLUTTER_ENABLE_PROFILE
static const GDebugKey clutter_profile_keys[] = {
+ {"picking-only", CLUTTER_PROFILE_PICKING_ONLY },
{"disable-report", CLUTTER_PROFILE_DISABLE_REPORT }
};
#endif /* CLUTTER_ENABLE_DEBUG */
if (clutter_debug_flags & CLUTTER_DEBUG_NOP_PICKING)
return CLUTTER_ACTOR (stage);
+#ifdef CLUTTER_ENABLE_PROFILE
+ if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
+ _clutter_profile_resume ();
+#endif /* CLUTTER_ENABLE_PROFILE */
+
CLUTTER_COUNTER_INC (_clutter_uprof_context, do_pick_counter);
CLUTTER_TIMER_START (_clutter_uprof_context, pick_timer);
if (pixel[0] == 0xff && pixel[1] == 0xff && pixel[2] == 0xff)
{
- CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_timer);
- return CLUTTER_ACTOR (stage);
+ actor = CLUTTER_ACTOR (stage);
+ goto result;
}
id = _clutter_pixel_to_id (pixel);
actor = clutter_get_actor_by_gid (id);
+result:
+
CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_timer);
+#ifdef CLUTTER_ENABLE_PROFILE
+ if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
+ _clutter_profile_suspend ();
+#endif
+
return actor;
}
/* - will call to backend and cogl */
_clutter_feature_init ();
+#ifdef CLUTTER_ENABLE_PROFILE
+ if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
+ _clutter_profile_suspend ();
+#endif
+
/*
* Resolution requires display to be open, so can only be queried after
* the post_parse hooks run.
UProfContext *_clutter_uprof_context;
#define REPORT_COLUMN0_WIDTH 40
+static gboolean searched_for_gl_uprof_context = FALSE;
+static UProfContext *gl_uprof_context = NULL;
+
typedef struct _ClutterUProfReportState
{
gulong n_frames;
uprof_context_unref (_clutter_uprof_context);
}
+void
+_clutter_profile_suspend (void)
+{
+ if (G_UNLIKELY (!searched_for_gl_uprof_context))
+ {
+ gl_uprof_context = uprof_find_context ("OpenGL");
+ searched_for_gl_uprof_context = TRUE;
+ }
+
+ if (gl_uprof_context)
+ uprof_context_suspend (gl_uprof_context);
+
+ /* NB: The Cogl context is linked to this so it will also be suspended... */
+ uprof_context_suspend (_clutter_uprof_context);
+}
+
+void
+_clutter_profile_resume (void)
+{
+ if (gl_uprof_context)
+ uprof_context_resume (gl_uprof_context);
+
+ /* NB: The Cogl context is linked to this so it will also be resumed... */
+ uprof_context_resume (_clutter_uprof_context);
+}
+
#endif
G_BEGIN_DECLS
typedef enum {
+ CLUTTER_PROFILE_PICKING_ONLY = 1 << 0,
CLUTTER_PROFILE_DISABLE_REPORT = 1 << 1
} ClutterProfileFlag;
#define CLUTTER_TIMER_START UPROF_TIMER_START
#define CLUTTER_TIMER_STOP UPROF_TIMER_STOP
+void
+_clutter_profile_suspend (void);
+void
+_clutter_profile_resume (void);
+
#else /* CLUTTER_ENABLE_PROFILE */
#define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void _clutter_dummy_decl (void)
#define CLUTTER_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END
+#define _clutter_profile_suspend() G_STMT_START {} G_STMT_END
+#define _clutter_profile_resume() G_STMT_START {} G_STMT_END
+
#endif /* CLUTTER_ENABLE_PROFILE */
extern guint clutter_profile_flags;