radeonsi: add helper si_get_minimum_num_gfx_cs_dwords

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák 2019-02-12 15:23:01 -05:00
parent c59d238bb0
commit 09bb8c8557
2 changed files with 12 additions and 7 deletions

View File

@ -54,13 +54,7 @@ void si_need_gfx_cs_space(struct si_context *ctx)
ctx->gtt = 0;
ctx->vram = 0;
/* If the IB is sufficiently large, don't count the space needed
* and just flush if there is not enough space left.
*
* Also reserve space for stopping queries at the end of IB, because
* the number of active queries is mostly unlimited.
*/
unsigned need_dwords = 2048 + ctx->num_cs_dw_queries_suspend;
unsigned need_dwords = si_get_minimum_num_gfx_cs_dwords(ctx);
if (!ctx->ws->cs_check_space(cs, need_dwords))
si_flush_gfx_cs(ctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
}

View File

@ -1434,6 +1434,17 @@ si_tile_mode_index(struct si_texture *tex, unsigned level, bool stencil)
return tex->surface.u.legacy.tiling_index[level];
}
static inline unsigned
si_get_minimum_num_gfx_cs_dwords(struct si_context *sctx)
{
/* Don't count the needed CS space exactly and just use an upper bound.
*
* Also reserve space for stopping queries at the end of IB, because
* the number of active queries is unlimited in theory.
*/
return 2048 + sctx->num_cs_dw_queries_suspend;
}
static inline void
si_context_add_resource_size(struct si_context *sctx, struct pipe_resource *r)
{