From e6529d6dccde385e7f39e704b699171b83597c04 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 14 Jan 2023 18:24:32 -0500 Subject: [PATCH] panfrost: Don't update access with a single batch drawoverhead test 25 from 462->492 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_job.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 171f3dc..a318f75 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -48,6 +48,18 @@ panfrost_batch_idx(struct panfrost_batch *batch) return batch - batch->ctx->batches.slots; } +static bool +panfrost_any_batch_other_than(struct panfrost_context *ctx, unsigned index) +{ + unsigned i; + foreach_batch(ctx, i) { + if (i != index) + return true; + } + + return false; +} + /* Adds the BO backing surface to a batch if the surface is non-null */ static void @@ -235,6 +247,17 @@ panfrost_batch_update_access(struct panfrost_batch *batch, { struct panfrost_context *ctx = batch->ctx; uint32_t batch_idx = panfrost_batch_idx(batch); + + if (writes) { + _mesa_hash_table_insert(ctx->writers, rsrc, batch); + } + + /* The rest of this routine is just about flushing other batches. If there + * aren't any, we can skip a lot of work. + */ + if (!panfrost_any_batch_other_than(ctx, batch_idx)) + return; + struct hash_entry *entry = _mesa_hash_table_search(ctx->writers, rsrc); struct panfrost_batch *writer = entry ? entry->data : NULL; @@ -257,10 +280,6 @@ panfrost_batch_update_access(struct panfrost_batch *batch, panfrost_batch_submit(ctx, batch); } } - - if (writes) { - _mesa_hash_table_insert(ctx->writers, rsrc, batch); - } } static pan_bo_access * -- 2.7.4