panfrost: Don't update access with a single batch

drawoverhead test 25 from 462->492

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21848>
This commit is contained in:
Alyssa Rosenzweig 2023-01-14 18:24:32 -05:00 committed by Marge Bot
parent c224bc6f70
commit e6529d6dcc

View file

@ -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 *