[mutter/gbsneto/runtime-debug-flags: 16/16] Allow changing Clutter debug flags at runtime
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/runtime-debug-flags: 16/16] Allow changing Clutter debug flags at runtime
- Date: Fri, 25 Oct 2019 19:13:03 +0000 (UTC)
commit 563e7139b620cc1702933ef5f42e0a8306fc7cf1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Mar 21 11:49:04 2019 +0000
Allow changing Clutter debug flags at runtime
This way, we can simply pop up the Looking Glass and run:
>>> Meta.add_clutter_debug_flags(Clutter.DebugFlag.PICK, 0, 0)
And measure specific actions or events on GNOME Shell.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/862
clutter/clutter/clutter-debug.h | 39 ---------------------------------
clutter/clutter/clutter-main.c | 30 ++++++++++++++++++++++++++
clutter/clutter/clutter-main.h | 48 +++++++++++++++++++++++++++++++++++++++++
src/core/util.c | 17 +++++++++++++++
src/meta/util.h | 10 +++++++++
5 files changed, 105 insertions(+), 39 deletions(-)
---
diff --git a/clutter/clutter/clutter-debug.h b/clutter/clutter/clutter-debug.h
index 7d170d2d5..76b8505cb 100644
--- a/clutter/clutter/clutter-debug.h
+++ b/clutter/clutter/clutter-debug.h
@@ -6,45 +6,6 @@
G_BEGIN_DECLS
-typedef enum
-{
- CLUTTER_DEBUG_MISC = 1 << 0,
- CLUTTER_DEBUG_ACTOR = 1 << 1,
- CLUTTER_DEBUG_TEXTURE = 1 << 2,
- CLUTTER_DEBUG_EVENT = 1 << 3,
- CLUTTER_DEBUG_PAINT = 1 << 4,
- CLUTTER_DEBUG_PANGO = 1 << 5,
- CLUTTER_DEBUG_BACKEND = 1 << 6,
- CLUTTER_DEBUG_SCHEDULER = 1 << 7,
- CLUTTER_DEBUG_SCRIPT = 1 << 8,
- CLUTTER_DEBUG_SHADER = 1 << 9,
- CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
- CLUTTER_DEBUG_ANIMATION = 1 << 11,
- CLUTTER_DEBUG_LAYOUT = 1 << 12,
- CLUTTER_DEBUG_PICK = 1 << 13,
- CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
- CLUTTER_DEBUG_CLIPPING = 1 << 15,
- CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16
-} ClutterDebugFlag;
-
-typedef enum
-{
- CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
-} ClutterPickDebugFlag;
-
-typedef enum
-{
- CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
- 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_CONTINUOUS_REDRAW = 1 << 6,
- CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
- CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
-} ClutterDrawDebugFlag;
-
#ifdef CLUTTER_ENABLE_DEBUG
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 3b1eec459..c4c24cc50 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -2605,6 +2605,36 @@ clutter_check_windowing_backend (const char *backend_type)
return FALSE;
}
+/**
+ * clutter_add_debug_flags: (skip)
+ *
+ * Adds the debug flags passed to the list of debug flags.
+ */
+void
+clutter_add_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags)
+{
+ clutter_debug_flags |= debug_flags;
+ clutter_paint_debug_flags |= draw_flags;
+ clutter_pick_debug_flags |= pick_flags;
+}
+
+/**
+ * clutter_remove_debug_flags: (skip)
+ *
+ * Removes the debug flags passed from the list of debug flags.
+ */
+void
+clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags)
+{
+ clutter_debug_flags &= ~debug_flags;
+ clutter_paint_debug_flags &= ~draw_flags;
+ clutter_pick_debug_flags &= ~pick_flags;
+}
+
void
_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
{
diff --git a/clutter/clutter/clutter-main.h b/clutter/clutter/clutter-main.h
index 16de42bf3..32653f61a 100644
--- a/clutter/clutter/clutter-main.h
+++ b/clutter/clutter/clutter-main.h
@@ -34,6 +34,45 @@
G_BEGIN_DECLS
+typedef enum
+{
+ CLUTTER_DEBUG_MISC = 1 << 0,
+ CLUTTER_DEBUG_ACTOR = 1 << 1,
+ CLUTTER_DEBUG_TEXTURE = 1 << 2,
+ CLUTTER_DEBUG_EVENT = 1 << 3,
+ CLUTTER_DEBUG_PAINT = 1 << 4,
+ CLUTTER_DEBUG_PANGO = 1 << 5,
+ CLUTTER_DEBUG_BACKEND = 1 << 6,
+ CLUTTER_DEBUG_SCHEDULER = 1 << 7,
+ CLUTTER_DEBUG_SCRIPT = 1 << 8,
+ CLUTTER_DEBUG_SHADER = 1 << 9,
+ CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
+ CLUTTER_DEBUG_ANIMATION = 1 << 11,
+ CLUTTER_DEBUG_LAYOUT = 1 << 12,
+ CLUTTER_DEBUG_PICK = 1 << 13,
+ CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
+ CLUTTER_DEBUG_CLIPPING = 1 << 15,
+ CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
+} ClutterDebugFlag;
+
+typedef enum
+{
+ CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
+} ClutterPickDebugFlag;
+
+typedef enum
+{
+ CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
+ CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
+ 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_CONTINUOUS_REDRAW = 1 << 6,
+ CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
+ CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
+} ClutterDrawDebugFlag;
+
/**
* CLUTTER_INIT_ERROR:
*
@@ -158,6 +197,15 @@ guint clutter_get_default_frame_rate (void);
CLUTTER_EXPORT
gboolean clutter_check_windowing_backend (const char *backend_type);
+CLUTTER_EXPORT
+void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags);
+
+CLUTTER_EXPORT
+void clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags);
G_END_DECLS
diff --git a/src/core/util.c b/src/core/util.c
index 79bcfdcfd..ebf1598db 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -1030,5 +1030,22 @@ meta_generate_random_id (GRand *rand,
return id;
}
+
+void
+meta_add_clutter_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags)
+{
+ clutter_add_debug_flags (debug_flags, draw_flags, pick_flags);
+}
+
+void
+meta_remove_clutter_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags)
+{
+ clutter_remove_debug_flags (debug_flags, draw_flags, pick_flags);
+}
+
/* eof util.c */
diff --git a/src/meta/util.h b/src/meta/util.h
index 6f3a98799..3c9ce2e90 100644
--- a/src/meta/util.h
+++ b/src/meta/util.h
@@ -223,4 +223,14 @@ typedef enum
META_EXPORT
MetaLocaleDirection meta_get_locale_direction (void);
+META_EXPORT
+void meta_add_clutter_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags);
+
+META_EXPORT
+void meta_remove_clutter_debug_flags (ClutterDebugFlag debug_flags,
+ ClutterDrawDebugFlag draw_flags,
+ ClutterPickDebugFlag pick_flags);
+
#endif /* META_UTIL_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]