radeonsi: inline si_need_gfx_cs_space

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12656>
This commit is contained in:
Marek Olšák 2021-08-13 09:36:30 -04:00 committed by Marge Bot
parent 77a0411694
commit 9fb77745f5
2 changed files with 18 additions and 19 deletions

View File

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

View File

@ -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).
*