Mesa (main): aux/trace: fix query handling with tc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat May 22 14:02:43 UTC 2021


Module: Mesa
Branch: main
Commit: 33e70015721711382086dcc9b751d6d54ffc63ed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33e70015721711382086dcc9b751d6d54ffc63ed

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon May 17 14:01:49 2021 -0400

aux/trace: fix query handling with tc

trace needs to follow the tc rules for queries a little in order to avoid
crashing and provide drivers with the same behavior they expect

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10899>

---

 src/gallium/auxiliary/driver_trace/tr_context.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/driver_trace/tr_context.c b/src/gallium/auxiliary/driver_trace/tr_context.c
index 72e83ddcd89..85e0f426b17 100644
--- a/src/gallium/auxiliary/driver_trace/tr_context.c
+++ b/src/gallium/auxiliary/driver_trace/tr_context.c
@@ -45,6 +45,7 @@
 
 struct trace_query
 {
+   struct threaded_query base;
    unsigned type;
 
    struct pipe_query *query;
@@ -224,19 +225,21 @@ trace_context_begin_query(struct pipe_context *_pipe,
 
 static bool
 trace_context_end_query(struct pipe_context *_pipe,
-                        struct pipe_query *query)
+                        struct pipe_query *_query)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
    bool ret;
 
-   query = trace_query_unwrap(query);
+   struct pipe_query *query = trace_query_unwrap(_query);
 
    trace_dump_call_begin("pipe_context", "end_query");
 
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(ptr, query);
 
+   if (tr_ctx->threaded)
+      threaded_query(query)->flushed = trace_query(_query)->base.flushed;
    ret = pipe->end_query(pipe, query);
 
    trace_dump_call_end();
@@ -261,6 +264,9 @@ trace_context_get_query_result(struct pipe_context *_pipe,
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(ptr, query);
 
+   if (tr_ctx->threaded)
+      threaded_query(query)->flushed = trace_query(_query)->base.flushed;
+
    ret = pipe->get_query_result(pipe, query, wait, result);
 
    trace_dump_arg_begin("result");



More information about the mesa-commit mailing list