From 3bd5120a57c13b8bc761c856f979ade4ce63952d Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 27 Jan 2021 10:56:05 +0100 Subject: [PATCH] radeonsi/sqtt: allow AMD_THREAD_TRACE_TRIGGER to be a frame number MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This makes it easier to capture the exact same frame (for instance from an apitrace replay). Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_sqtt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_sqtt.c b/src/gallium/drivers/radeonsi/si_sqtt.c index 60e53b5..4ad1d2e 100644 --- a/src/gallium/drivers/radeonsi/si_sqtt.c +++ b/src/gallium/drivers/radeonsi/si_sqtt.c @@ -560,10 +560,14 @@ si_init_thread_trace(struct si_context *sctx) sctx->thread_trace->buffer_size = debug_get_num_option("AMD_THREAD_TRACE_BUFFER_SIZE", 1024) * 1024; sctx->thread_trace->start_frame = 10; - const char *trigger_file = getenv("AMD_THREAD_TRACE_TRIGGER"); - if (trigger_file) { - sctx->thread_trace->trigger_file = strdup(trigger_file); - sctx->thread_trace->start_frame = -1; + const char *trigger = getenv("AMD_THREAD_TRACE_TRIGGER"); + if (trigger) { + sctx->thread_trace->start_frame = atoi(trigger); + if (sctx->thread_trace->start_frame <= 0) { + /* This isn't a frame number, must be a file */ + sctx->thread_trace->trigger_file = strdup(trigger); + sctx->thread_trace->start_frame = -1; + } } if (!si_thread_trace_init_bo(sctx)) -- 2.7.4