Mesa (main): radeonsi: simplify si_need_gfx_cs_space
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 1 01:04:21 UTC 2021
Module: Mesa
Branch: main
Commit: 48632778b99580fdb415238992ecd968d7b21eb4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=48632778b99580fdb415238992ecd968d7b21eb4
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Aug 11 12:10:28 2021 -0400
radeonsi: simplify si_need_gfx_cs_space
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12656>
---
src/gallium/drivers/radeonsi/si_gfx_cs.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c
index f91a6445474..15c5dbb1711 100644
--- a/src/gallium/drivers/radeonsi/si_gfx_cs.c
+++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c
@@ -31,7 +31,6 @@
#include "util/u_upload_mgr.h"
#include "ac_debug.h"
-/* initialize */
void si_need_gfx_cs_space(struct si_context *ctx, unsigned num_draws)
{
struct radeon_cmdbuf *cs = &ctx->gfx_cs;
@@ -40,16 +39,14 @@ void si_need_gfx_cs_space(struct si_context *ctx, unsigned num_draws)
* that have been added (cs_add_buffer) and one counter in the pipe
* driver for those that haven't been added yet.
*/
- if (unlikely(!radeon_cs_memory_below_limit(ctx->screen, &ctx->gfx_cs, ctx->memory_usage_kb))) {
- ctx->memory_usage_kb = 0;
- si_flush_gfx_cs(ctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
- return;
- }
+ uint32_t kb = ctx->memory_usage_kb;
ctx->memory_usage_kb = 0;
- unsigned need_dwords = si_get_minimum_num_gfx_cs_dwords(ctx, num_draws);
- if (!ctx->ws->cs_check_space(cs, need_dwords, false))
- si_flush_gfx_cs(ctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
+ if (radeon_cs_memory_below_limit(ctx->screen, &ctx->gfx_cs, kb) &&
+ ctx->ws->cs_check_space(cs, si_get_minimum_num_gfx_cs_dwords(ctx, num_draws), false))
+ return;
+
+ si_flush_gfx_cs(ctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
}
void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_handle **fence)
More information about the mesa-commit
mailing list