aux/trace: enhance trigger mode to dump context states during bind
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 7 Apr 2021 12:23:50 +0000 (08:23 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Apr 2021 02:04:22 +0000 (02:04 +0000)
when dumping a single frame, the creation info for these states hasn't been
dumped yet, so always dump it during bind so it's visible

Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10093>

src/gallium/auxiliary/driver_trace/tr_context.c
src/gallium/auxiliary/driver_trace/tr_dump.c
src/gallium/auxiliary/driver_trace/tr_dump.h

index 1a25678..25f0821 100644 (file)
@@ -305,7 +305,10 @@ trace_context_bind_blend_state(struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "bind_blend_state");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(ptr, state);
+   if (trace_dump_is_triggered())
+      trace_dump_arg(blend_state, state);
+   else
+      trace_dump_arg(ptr, state);
 
    pipe->bind_blend_state(pipe, state);
 
@@ -432,7 +435,10 @@ trace_context_bind_rasterizer_state(struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "bind_rasterizer_state");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(ptr, state);
+   if (trace_dump_is_triggered())
+      trace_dump_arg(rasterizer_state, state);
+   else
+      trace_dump_arg(ptr, state);
 
    pipe->bind_rasterizer_state(pipe, state);
 
@@ -491,7 +497,10 @@ trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "bind_depth_stencil_alpha_state");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(ptr, state);
+   if (trace_dump_is_triggered())
+      trace_dump_arg(depth_stencil_alpha_state, state);
+   else
+      trace_dump_arg(ptr, state);
 
    pipe->bind_depth_stencil_alpha_state(pipe, state);
 
index 20f498e..9032ddf 100644 (file)
@@ -99,6 +99,12 @@ trace_dump_check_trigger(void)
    mtx_unlock(&call_mutex);
 }
 
+bool
+trace_dump_is_triggered(void)
+{
+   return trigger_active && !!trigger_filename;
+}
+
 static inline void
 trace_dump_write(const char *buf, size_t size)
 {
index 48e648b..9a4b294 100644 (file)
@@ -110,6 +110,7 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
 
 void trace_dump_trigger_active(bool active);
 void trace_dump_check_trigger(void);
+bool trace_dump_is_triggered(void);
 
 /*
  * Code saving macros.