radeonsi: simplify 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-11 12:10:28 -04:00
committed by Marge Bot
parent 85742b28ef
commit 48632778b9
+6 -9
View File
@@ -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)