diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 8ac628616bc93b647169f9ad48e8cb74e5043f6b..3151ecc0cec3e25c665bec07d9b2e211642e039e 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -2085,8 +2085,10 @@ static void si_draw(struct pipe_context *ctx,
 
    si_need_gfx_cs_space(sctx, num_draws, ALT_HIZ_LOGIC ? 8 : 0);
 
+#ifdef HAVE_PERFETTO
    if (unlikely(sctx->perfetto_enabled))
       trace_si_begin_draw(&sctx->trace);
+#endif
 
    unsigned instance_count = info->instance_count;
 
@@ -2437,10 +2439,12 @@ static void si_draw(struct pipe_context *ctx,
       zstex->depth_cleared_level_mask &= ~BITFIELD_BIT(sctx->framebuffer.state.zsbuf->u.tex.level);
    }
 
+#ifdef HAVE_PERFETTO
    if (unlikely(sctx->perfetto_enabled)) {
       /* Just use the draw[0] vertex count for perfetto. */
       trace_si_end_draw(&sctx->trace, draws[0].count);
    }
+#endif
 
    DRAW_CLEANUP;
 }