Mesa (main): freedreno: Move the !MAP_WRITE write batch refcounting to the branch.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 17 16:32:13 UTC 2021
Module: Mesa
Branch: main
Commit: 09e1fb2bceb650d700bf94f668c116ec93a58319
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=09e1fb2bceb650d700bf94f668c116ec93a58319
Author: Emma Anholt <emma at anholt.net>
Date: Tue Jun 15 10:43:11 2021 -0700
freedreno: Move the !MAP_WRITE write batch refcounting to the branch.
For MAP_WRITE, we flush all the batches referencing the BO, so the write
batch will get flushed anyway. No need to take an extra ref.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11439>
---
src/gallium/drivers/freedreno/freedreno_resource.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index d3981c15fd9..59408c63859 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -664,12 +664,6 @@ static void
flush_resource(struct fd_context *ctx, struct fd_resource *rsc,
unsigned usage) assert_dt
{
- struct fd_batch *write_batch = NULL;
-
- fd_screen_lock(ctx->screen);
- fd_batch_reference_locked(&write_batch, rsc->track->write_batch);
- fd_screen_unlock(ctx->screen);
-
if (usage & PIPE_MAP_WRITE) {
struct fd_batch *batch, *batches[32] = {};
uint32_t batch_count = 0;
@@ -688,11 +682,16 @@ flush_resource(struct fd_context *ctx, struct fd_resource *rsc,
fd_batch_flush(batches[i]);
fd_batch_reference(&batches[i], NULL);
}
- } else if (write_batch) {
- fd_batch_flush(write_batch);
+ } else {
+ struct fd_batch *write_batch = NULL;
+ fd_screen_lock(ctx->screen);
+ fd_batch_reference_locked(&write_batch, rsc->track->write_batch);
+ fd_screen_unlock(ctx->screen);
+ if (write_batch) {
+ fd_batch_flush(write_batch);
+ fd_batch_reference(&write_batch, NULL);
+ }
}
-
- fd_batch_reference(&write_batch, NULL);
}
static void
More information about the mesa-commit
mailing list