Mesa (main): freedreno: Drop a bit of indirection around the batch cache flush path.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 15 20:59:33 UTC 2021
Module: Mesa
Branch: main
Commit: bfb83d1fe80e8d88fafe16484422a08e2ffa6b8c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfb83d1fe80e8d88fafe16484422a08e2ffa6b8c
Author: Emma Anholt <emma at anholt.net>
Date: Mon Jun 14 12:02:26 2021 -0700
freedreno: Drop a bit of indirection around the batch cache flush path.
Checking the flag to call separate functions which then call the same
helper with the flag is a bit silly.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
---
.../drivers/freedreno/freedreno_batch_cache.c | 27 +++++++---------------
.../drivers/freedreno/freedreno_batch_cache.h | 3 +--
src/gallium/drivers/freedreno/freedreno_context.c | 4 +---
3 files changed, 10 insertions(+), 24 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
index e6fe83ff35c..278d5871be5 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
@@ -141,8 +141,9 @@ fd_bc_fini(struct fd_batch_cache *cache)
_mesa_hash_table_destroy(cache->ht, NULL);
}
-static void
-bc_flush(struct fd_context *ctx, bool deferred) assert_dt
+/* Flushes all batches in the batch cache. Used at glFlush() and similar times. */
+void
+fd_bc_flush(struct fd_context *ctx, bool deferred) assert_dt
{
struct fd_batch_cache *cache = &ctx->screen->batch_cache;
@@ -162,6 +163,11 @@ bc_flush(struct fd_context *ctx, bool deferred) assert_dt
}
}
+ /* deferred flush doesn't actually flush, but it marks every other
+ * batch associated with the context as dependent on the current
+ * batch. So when the current batch gets flushed, all other batches
+ * that came before also get flushed.
+ */
if (deferred) {
struct fd_batch *current_batch = fd_context_batch(ctx);
@@ -188,23 +194,6 @@ bc_flush(struct fd_context *ctx, bool deferred) assert_dt
}
}
-void
-fd_bc_flush(struct fd_context *ctx)
-{
- bc_flush(ctx, false);
-}
-
-/* deferred flush doesn't actually flush, but it marks every other
- * batch associated with the context as dependent on the current
- * batch. So when the current batch gets flushed, all other batches
- * that came before also get flushed.
- */
-void
-fd_bc_flush_deferred(struct fd_context *ctx)
-{
- bc_flush(ctx, true);
-}
-
void
fd_bc_dump(struct fd_context *ctx, const char *fmt, ...)
{
diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.h b/src/gallium/drivers/freedreno/freedreno_batch_cache.h
index 277616cf677..c85a6976583 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.h
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.h
@@ -66,8 +66,7 @@ struct fd_batch_cache {
void fd_bc_init(struct fd_batch_cache *cache);
void fd_bc_fini(struct fd_batch_cache *cache);
-void fd_bc_flush(struct fd_context *ctx) assert_dt;
-void fd_bc_flush_deferred(struct fd_context *ctx) assert_dt;
+void fd_bc_flush(struct fd_context *ctx, bool deferred) assert_dt;
void fd_bc_dump(struct fd_context *ctx, const char *fmt, ...)
_util_printf_format(2, 3);
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 70d0558cecd..618df948732 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -129,10 +129,8 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
if (!ctx->screen->reorder) {
fd_batch_flush(batch);
- } else if (flags & PIPE_FLUSH_DEFERRED) {
- fd_bc_flush_deferred(ctx);
} else {
- fd_bc_flush(ctx);
+ fd_bc_flush(ctx, flags & PIPE_FLUSH_DEFERRED);
}
fd_bc_dump(ctx, "%p: remaining:\n", ctx);
More information about the mesa-commit
mailing list