freedreno: Add FD_DIRTY_QUERY

Replace update_active_queries, which was really just a dirty-bit in
disguise.  This also lets us associate it with FD_DIRTY_RESOURCE so
we can skip the associated resource tracking when it isn't dirty.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>
This commit is contained in:
Rob Clark 2023-02-07 09:07:28 -08:00 committed by Marge Bot
parent 3a98822cc7
commit b70ea03302
9 changed files with 17 additions and 21 deletions

View file

@ -468,7 +468,7 @@ fd5_blitter_blit(struct fd_context *ctx,
/* Acc query state will have been dirtied by our fd_batch_update_queries, so
* the ctx->batch may need to turn its queries back on.
*/
ctx->update_active_queries = true;
fd_context_dirty(ctx, FD_DIRTY_QUERY);
return true;
}

View file

@ -928,7 +928,7 @@ fd6_clear_texture(struct pipe_context *pctx, struct pipe_resource *prsc,
/* Acc query state will have been dirtied by our fd_batch_update_queries, so
* the ctx->batch may need to turn its queries back on.
*/
ctx->update_active_queries = true;
fd_context_dirty(ctx, FD_DIRTY_QUERY);
return;
@ -1080,7 +1080,7 @@ handle_rgba_blit(struct fd_context *ctx,
/* Acc query state will have been dirtied by our fd_batch_update_queries, so
* the ctx->batch may need to turn its queries back on.
*/
ctx->update_active_queries = true;
fd_context_dirty(ctx, FD_DIRTY_QUERY);
return true;
}

View file

@ -374,7 +374,7 @@ fd_batch_update_queries(struct fd_batch *batch) assert_dt
{
struct fd_context *ctx = batch->ctx;
if (!ctx->update_active_queries)
if (!(ctx->dirty & FD_DIRTY_QUERY))
return;
ctx->query_update_batch(batch, false);

View file

@ -164,9 +164,10 @@ enum fd_dirty_3d_state {
FD_DIRTY_TEX = BIT(17),
FD_DIRTY_IMAGE = BIT(18),
FD_DIRTY_SSBO = BIT(19),
FD_DIRTY_QUERY = BIT(20),
/* only used by a2xx.. possibly can be removed.. */
FD_DIRTY_TEXSTATE = BIT(20),
FD_DIRTY_TEXSTATE = BIT(21),
/* fine grained state changes, for cases where state is not orthogonal
* from hw perspective:
@ -256,11 +257,6 @@ struct fd_context {
float default_inner_level[2] dt;
uint8_t patch_vertices dt;
/* Whether we need to recheck the active_queries list next
* fd_batch_update_queries().
*/
bool update_active_queries dt;
/* Current state of pctx->set_active_query_state() (i.e. "should drawing
* be counted against non-perfcounter queries")
*/
@ -606,7 +602,7 @@ fd_context_dirty_resource(enum fd_dirty_3d_state dirty)
{
return dirty & (FD_DIRTY_FRAMEBUFFER | FD_DIRTY_ZSA | FD_DIRTY_BLEND |
FD_DIRTY_SSBO | FD_DIRTY_IMAGE | FD_DIRTY_VTXBUF |
FD_DIRTY_TEX | FD_DIRTY_STREAMOUT);
FD_DIRTY_TEX | FD_DIRTY_STREAMOUT | FD_DIRTY_QUERY);
}
/* Mark specified non-shader-stage related state as dirty: */

View file

@ -185,6 +185,12 @@ batch_draw_tracking_for_dirty_bits(struct fd_batch *batch) assert_dt
resource_written(batch, ctx->streamout.targets[i]->buffer);
}
if (ctx->dirty & FD_DIRTY_QUERY) {
list_for_each_entry (struct fd_acc_query, aq, &ctx->acc_active_queries, node) {
resource_written(batch, aq->prsc);
}
}
/* any buffers that haven't been cleared yet, we need to restore: */
batch->restore |= restore_buffers & (FD_BUFFER_ALL & ~batch->invalidated);
/* and any buffers used, need to be resolved: */
@ -227,9 +233,6 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
resource_written(batch, batch->query_buf);
list_for_each_entry (struct fd_acc_query, aq, &ctx->acc_active_queries, node)
resource_written(batch, aq->prsc);
fd_screen_unlock(ctx->screen);
}

View file

@ -194,7 +194,7 @@ fd_set_active_query_state(struct pipe_context *pctx, bool enable) assert_dt
{
struct fd_context *ctx = fd_context(pctx);
ctx->active_queries = enable;
ctx->update_active_queries = true;
fd_context_dirty(ctx, FD_DIRTY_QUERY);
}
static enum pipe_driver_query_type

View file

@ -104,7 +104,7 @@ fd_acc_begin_query(struct fd_context *ctx, struct fd_query *q) assert_dt
realloc_query_bo(ctx, aq);
/* Signal that we need to update the active queries on the next draw */
ctx->update_active_queries = true;
fd_context_dirty(ctx, FD_DIRTY_QUERY);
/* add to active list: */
assert(list_is_empty(&aq->node));
@ -312,7 +312,7 @@ fd_acc_query_update_batch(struct fd_batch *batch, bool disable_all)
{
struct fd_context *ctx = batch->ctx;
if (disable_all || ctx->update_active_queries) {
if (disable_all || (ctx->dirty & FD_DIRTY_QUERY)) {
struct fd_acc_query *aq;
LIST_FOR_EACH_ENTRY (aq, &ctx->acc_active_queries, node) {
bool batch_change = aq->batch != batch;
@ -326,8 +326,6 @@ fd_acc_query_update_batch(struct fd_batch *batch, bool disable_all)
fd_acc_query_resume(aq, batch);
}
}
ctx->update_active_queries = false;
}
void

View file

@ -375,7 +375,7 @@ fd_hw_query_update_batch(struct fd_batch *batch, bool disable_all)
{
struct fd_context *ctx = batch->ctx;
if (disable_all || ctx->update_active_queries) {
if (disable_all || (ctx->dirty & FD_DIRTY_QUERY)) {
struct fd_hw_query *hq;
LIST_FOR_EACH_ENTRY (hq, &batch->ctx->hw_active_queries, list) {
bool was_active = query_active_in_batch(batch, hq);

View file

@ -321,7 +321,6 @@ fd_set_framebuffer_state(struct pipe_context *pctx,
fd_batch_reference(&ctx->batch, NULL);
fd_context_all_dirty(ctx);
ctx->update_active_queries = true;
fd_batch_reference(&old_batch, NULL);
} else if (ctx->batch) {