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>
This commit is contained in:
Emma Anholt 2021-06-14 12:02:26 -07:00 committed by Marge Bot
parent 32bed95e0b
commit bfb83d1fe8
3 changed files with 10 additions and 24 deletions

View file

@ -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, ...)
{

View file

@ -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);

View file

@ -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);