From 2eddf35625b9bb43f4324f9b0a664400ecad05d3 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Sat, 31 Aug 2024 18:43:40 +0200 Subject: [PATCH] cogl/trace: Fix build without profiler When !3952 introduced the new tracing macros, they were only defined in the HAVE_PROFILER case, causing builds without profiler support to fail. Also it introduced an unconditional call to cogl_is_tracing_enabled() which is not available without HAVE_PROFILER. Fixes: 777c63507 ("cogl/trace: Allow defining and setting sysprof trace counters") Fixes: 322ac42a6 ("stage-impl: Trace the damage region") Part-of: --- cogl/cogl/cogl-trace.h | 4 ++++ src/backends/meta-stage-impl.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cogl/cogl/cogl-trace.h b/cogl/cogl/cogl-trace.h index 860c153a8..bfc992efa 100644 --- a/cogl/cogl/cogl-trace.h +++ b/cogl/cogl/cogl-trace.h @@ -240,6 +240,10 @@ cogl_trace_counter_data_double (gpointer user_data) #define COGL_TRACE_SCOPED_ANCHOR(Name) (void) 0 #define COGL_TRACE_BEGIN_ANCHORED(Name, name) (void) 0 #define COGL_TRACE_MESSAGE(name, ...) (void) 0 +#define COGL_TRACE_DEFINE_COUNTER_INT(Name, name, description) (void) 0 +#define COGL_TRACE_DEFINE_COUNTER_DOUBLE(Name, name, description) (void) 0 +#define COGL_TRACE_SET_COUNTER_INT(Name, value) (void) 0 +#define COGL_TRACE_SET_COUNTER_DOUBLE(Name, value) (void) 0 COGL_EXPORT gboolean cogl_start_tracing_with_path (const char *filename, diff --git a/src/backends/meta-stage-impl.c b/src/backends/meta-stage-impl.c index ea30ac13d..6a5dcb92c 100644 --- a/src/backends/meta-stage-impl.c +++ b/src/backends/meta-stage-impl.c @@ -682,6 +682,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl, paint_stage (stage_impl, stage_view, redraw_clip, frame); } +#ifdef HAVE_PROFILER if (G_UNLIKELY (cogl_is_tracing_enabled ())) { g_autoptr (GString) rects_str = NULL; @@ -708,6 +709,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl, COGL_TRACE_DESCRIBE (RedrawViewPrimary, rects_str->str); COGL_TRACE_SET_COUNTER_INT (RedrawViewPrimaryDamageArea, area); } +#endif g_clear_pointer (&redraw_clip, mtk_region_unref); g_clear_pointer (&fb_clip_region, mtk_region_unref);