From 22486ffa5172dd0425479ce64785b0f29bf59cdf Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 25 Jan 2021 12:04:48 -0800 Subject: [PATCH] freedreno: Remove the submit lock locking. I think the whole submit lock thing should be possible to remove now, but just getting rid of the lock since we're no longer sharing batches between ctxes means another several percent draw overhead improvement. Part-of: --- src/gallium/drivers/freedreno/freedreno_batch.c | 4 ---- src/gallium/drivers/freedreno/freedreno_batch.h | 12 +----------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index dc1a850dc2b..f8ada703900 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -135,8 +135,6 @@ fd_batch_create(struct fd_context *ctx, bool nondraw) batch->ctx = ctx; batch->nondraw = nondraw; - simple_mtx_init(&batch->submit_lock, mtx_plain); - batch->resources = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); batch->dependents = @@ -321,8 +319,6 @@ __fd_batch_destroy(struct fd_batch *batch) batch_fini(batch); - simple_mtx_destroy(&batch->submit_lock); - free(batch); } diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h index c6edab46ef1..c74e5e862f2 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.h +++ b/src/gallium/drivers/freedreno/freedreno_batch.h @@ -65,11 +65,6 @@ struct fd_batch { struct fd_context *ctx; - /* emit_lock serializes cmdstream emission and flush. Acquire before - * screen->lock. - */ - simple_mtx_t submit_lock; - /* do we need to mem2gmem before rendering. We don't, if for example, * there was a glClear() that invalidated the entire previous buffer * contents. Keep track of which buffer(s) are cleared, or needs @@ -307,7 +302,6 @@ fd_batch_reference(struct fd_batch **ptr, struct fd_batch *batch) static inline void fd_batch_unlock_submit(struct fd_batch *batch) { - simple_mtx_unlock(&batch->submit_lock); } /** @@ -317,11 +311,7 @@ fd_batch_unlock_submit(struct fd_batch *batch) static inline bool MUST_CHECK fd_batch_lock_submit(struct fd_batch *batch) { - simple_mtx_lock(&batch->submit_lock); - bool ret = !batch->flushed; - if (!ret) - fd_batch_unlock_submit(batch); - return ret; + return !batch->flushed; } /**