Module: Mesa Branch: main Commit: ad0d5a24aa15381c3d5863951b847160573c6f8e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad0d5a24aa15381c3d5863951b847160573c6f8e
Author: Mike Blumenkrantz <[email protected]> Date: Wed Feb 22 14:58:44 2023 -0500 aux/tc: track whether queries have been terminated in a renderpass on tilers it's important to know whether a query is ended mid-renderpass so that the query begin can occur inside/outside of the renderpass Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21533> --- src/gallium/auxiliary/util/u_threaded_context.c | 5 +++++ src/gallium/auxiliary/util/u_threaded_context.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index bb89f6417b3..d323a7bc62a 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -207,10 +207,12 @@ tc_parse_draw(struct threaded_context *tc) info->cbuf_invalidate = 0; info->zsbuf_invalidate = false; info->has_draw = true; + info->has_query_ends |= tc->query_ended; } tc->in_renderpass = true; tc->seen_fb_state = true; + tc->query_ended = false; } static void * @@ -596,6 +598,7 @@ _tc_sync(struct threaded_context *tc, UNUSED const char *info, UNUSED const char tc->renderpass_info_recording->data32[0] = 0; } tc->seen_fb_state = false; + tc->query_ended = false; } MESA_TRACE_END(); @@ -1120,6 +1123,7 @@ tc_end_query(struct pipe_context *_pipe, struct pipe_query *query) call->query = query; tq->flushed = false; + tc->query_ended = true; return true; /* we don't care about the return value for this call */ } @@ -3459,6 +3463,7 @@ out_of_memory: if (!(flags & PIPE_FLUSH_DEFERRED)) { tc_flush_queries(tc); tc->seen_fb_state = false; + tc->query_ended = false; } tc_set_driver_thread(tc); pipe->flush(pipe, fence, flags); diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h index 69878daffc5..937c99db4c8 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.h +++ b/src/gallium/auxiliary/util/u_threaded_context.h @@ -446,7 +446,9 @@ struct tc_renderpass_info { bool has_draw : 1; /* whether a framebuffer resolve occurs on cbuf[0] */ bool has_resolve : 1; - uint8_t pad : 2; + /* whether queries are ended during this renderpass */ + bool has_query_ends : 1; + uint8_t pad : 1; /* 32 bits offset */ /* bitmask of color buffers using fbfetch */ uint8_t cbuf_fbfetch; @@ -587,6 +589,8 @@ struct threaded_context { bool seen_fb_state; /* whether a renderpass is currently active */ bool in_renderpass; + /* whether a query has ended more recently than a draw */ + bool query_ended; bool seen_streamout_buffers; bool seen_shader_buffers[PIPE_SHADER_TYPES];
