mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-21 03:10:35 +01:00
radeonsi: cache u_trace_perfetto_active value
u_trace_perfetto_active uses an atomic read so avoid doing it too much in hot path. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33207>
This commit is contained in:
parent
770b5bc757
commit
6c2edb9762
5 changed files with 14 additions and 10 deletions
|
|
@ -1237,7 +1237,7 @@ static void si_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info
|
|||
}
|
||||
}
|
||||
|
||||
if (u_trace_perfetto_active(&sctx->ds.trace_context))
|
||||
if (sctx->perfetto_enabled)
|
||||
trace_si_begin_compute(&sctx->trace);
|
||||
|
||||
if (sctx->bo_list_add_all_compute_resources)
|
||||
|
|
@ -1310,7 +1310,7 @@ static void si_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info
|
|||
sctx->compute_is_busy = true;
|
||||
sctx->num_compute_calls++;
|
||||
|
||||
if (u_trace_perfetto_active(&sctx->ds.trace_context))
|
||||
if (sctx->perfetto_enabled)
|
||||
trace_si_end_compute(&sctx->trace, info->grid[0], info->grid[1], info->grid[2]);
|
||||
|
||||
if (cs_regalloc_hang) {
|
||||
|
|
|
|||
|
|
@ -474,9 +474,8 @@ static void si_flush_all_queues(struct pipe_context *ctx,
|
|||
si_handle_sqtt(sctx, &sctx->gfx_cs);
|
||||
}
|
||||
|
||||
if (u_trace_perfetto_active(&sctx->ds.trace_context)) {
|
||||
if (sctx->perfetto_enabled)
|
||||
u_trace_context_process(&sctx->ds.trace_context, flags & PIPE_FLUSH_END_OF_FRAME);
|
||||
}
|
||||
} else {
|
||||
/* Instead of flushing, create a deferred fence. Constraints:
|
||||
* - the gallium frontend must allow a deferred flush.
|
||||
|
|
|
|||
|
|
@ -192,7 +192,9 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h
|
|||
flags |= RADEON_FLUSH_NOOP;
|
||||
|
||||
uint64_t start_ts = 0, submission_id = 0;
|
||||
if (u_trace_perfetto_active(&ctx->ds.trace_context)) {
|
||||
const bool perfetto = ctx->perfetto_enabled;
|
||||
|
||||
if (perfetto) {
|
||||
start_ts = si_ds_begin_submit(&ctx->ds_queue);
|
||||
submission_id = ctx->ds_queue.submission_id;
|
||||
}
|
||||
|
|
@ -200,9 +202,8 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h
|
|||
/* Flush the CS. */
|
||||
ws->cs_flush(cs, flags, &ctx->last_gfx_fence);
|
||||
|
||||
if (u_trace_perfetto_active(&ctx->ds.trace_context) && start_ts > 0) {
|
||||
if (perfetto)
|
||||
si_ds_end_submit(&ctx->ds_queue, start_ts);
|
||||
}
|
||||
|
||||
tc_driver_internal_flush_notify(ctx->tc);
|
||||
if (fence)
|
||||
|
|
@ -227,7 +228,7 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h
|
|||
if (ctx->current_saved_cs)
|
||||
si_saved_cs_reference(&ctx->current_saved_cs, NULL);
|
||||
|
||||
if (u_trace_perfetto_active(&ctx->ds.trace_context))
|
||||
if (perfetto)
|
||||
si_utrace_flush(ctx, submission_id);
|
||||
|
||||
si_begin_new_gfx_cs(ctx, false);
|
||||
|
|
@ -433,6 +434,8 @@ void si_begin_new_gfx_cs(struct si_context *ctx, bool first_cs)
|
|||
if (!first_cs)
|
||||
u_trace_fini(&ctx->trace);
|
||||
|
||||
ctx->perfetto_enabled = u_trace_perfetto_active(&ctx->ds.trace_context);
|
||||
|
||||
u_trace_init(&ctx->trace, &ctx->ds.trace_context);
|
||||
|
||||
if (unlikely(radeon_uses_secure_bos(ctx->ws))) {
|
||||
|
|
|
|||
|
|
@ -1345,6 +1345,8 @@ struct si_context {
|
|||
enum rgp_sqtt_marker_event_type sqtt_next_event;
|
||||
bool sqtt_enabled;
|
||||
|
||||
bool perfetto_enabled;
|
||||
|
||||
unsigned context_flags;
|
||||
|
||||
/* Shaders. */
|
||||
|
|
|
|||
|
|
@ -2085,7 +2085,7 @@ static void si_draw(struct pipe_context *ctx,
|
|||
|
||||
si_need_gfx_cs_space(sctx, num_draws, ALT_HIZ_LOGIC ? 8 : 0);
|
||||
|
||||
if (u_trace_perfetto_active(&sctx->ds.trace_context))
|
||||
if (sctx->perfetto_enabled)
|
||||
trace_si_begin_draw(&sctx->trace);
|
||||
|
||||
unsigned instance_count = info->instance_count;
|
||||
|
|
@ -2437,7 +2437,7 @@ static void si_draw(struct pipe_context *ctx,
|
|||
zstex->depth_cleared_level_mask &= ~BITFIELD_BIT(sctx->framebuffer.state.zsbuf->u.tex.level);
|
||||
}
|
||||
|
||||
if (u_trace_perfetto_active(&sctx->ds.trace_context)) {
|
||||
if (sctx->perfetto_enabled) {
|
||||
/* Just use the draw[0] vertex count for perfetto. */
|
||||
trace_si_end_draw(&sctx->trace, draws[0].count);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue