From 9fb77745f5ffaf6f1cc5932152bec077b665d29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 13 Aug 2021 09:36:30 -0400 Subject: [PATCH] radeonsi: inline si_need_gfx_cs_space Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_gfx_cs.c | 18 ------------------ src/gallium/drivers/radeonsi/si_pipe.h | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c index 15c5dbb1711..b9305e77115 100644 --- a/src/gallium/drivers/radeonsi/si_gfx_cs.c +++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c @@ -31,24 +31,6 @@ #include "util/u_upload_mgr.h" #include "ac_debug.h" -void si_need_gfx_cs_space(struct si_context *ctx, unsigned num_draws) -{ - struct radeon_cmdbuf *cs = &ctx->gfx_cs; - - /* There are two memory usage counters in the winsys for all buffers - * that have been added (cs_add_buffer) and one counter in the pipe - * driver for those that haven't been added yet. - */ - uint32_t kb = ctx->memory_usage_kb; - ctx->memory_usage_kb = 0; - - 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) { struct radeon_cmdbuf *cs = &ctx->gfx_cs; diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 49634e9e723..a40666ed3e8 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1479,7 +1479,6 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h void si_allocate_gds(struct si_context *ctx); void si_set_tracked_regs_to_clear_state(struct si_context *ctx); void si_begin_new_gfx_cs(struct si_context *ctx, bool first_cs); -void si_need_gfx_cs_space(struct si_context *ctx, unsigned num_draws); void si_trace_emit(struct si_context *sctx); void si_prim_discard_signal_next_compute_ib_start(struct si_context *sctx); void si_emit_surface_sync(struct si_context *sctx, struct radeon_cmdbuf *cs, @@ -1929,6 +1928,24 @@ static inline bool radeon_cs_memory_below_limit(struct si_screen *screen, struct return kb + cs->used_vram_kb + cs->used_gart_kb < screen->max_memory_usage_kb; } +static inline void si_need_gfx_cs_space(struct si_context *ctx, unsigned num_draws) +{ + struct radeon_cmdbuf *cs = &ctx->gfx_cs; + + /* There are two memory usage counters in the winsys for all buffers + * that have been added (cs_add_buffer) and one counter in the pipe + * driver for those that haven't been added yet. + */ + uint32_t kb = ctx->memory_usage_kb; + ctx->memory_usage_kb = 0; + + 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); +} + /** * Add a buffer to the buffer list for the given command stream (CS). *