Mesa (master): radeonsi/sqtt: allow AMD_THREAD_TRACE_TRIGGER to be a frame number

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 29 09:09:22 UTC 2021


Module: Mesa
Branch: master
Commit: 3bd5120a57c13b8bc761c856f979ade4ce63952d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bd5120a57c13b8bc761c856f979ade4ce63952d

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Wed Jan 27 10:56:05 2021 +0100

radeonsi/sqtt: allow AMD_THREAD_TRACE_TRIGGER to be a frame number

This makes it easier to capture the exact same frame (for instance from an
apitrace replay).

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8746>

---

 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 60e53b5d1ca..4ad1d2ea6bb 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))



More information about the mesa-commit mailing list