ac,radeonsi: track memory usage in KB to reduce types from uint64 to uint32
Decreasing the time spent in radeon_cs_memory_below_limit is the motivation. Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8794>
This commit is contained in:
@@ -228,8 +228,8 @@ static void r600_dma_emit_wait_idle(struct r600_common_context *rctx)
|
||||
void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw,
|
||||
struct r600_resource *dst, struct r600_resource *src)
|
||||
{
|
||||
uint64_t vram = ctx->dma.cs.used_vram;
|
||||
uint64_t gtt = ctx->dma.cs.used_gart;
|
||||
uint64_t vram = (uint64_t)ctx->dma.cs.used_vram_kb * 1024;
|
||||
uint64_t gtt = (uint64_t)ctx->dma.cs.used_gart_kb * 1024;
|
||||
|
||||
if (dst) {
|
||||
vram += dst->vram_usage;
|
||||
@@ -264,7 +264,7 @@ void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw,
|
||||
*/
|
||||
num_dw++; /* for emit_wait_idle below */
|
||||
if (!ctx->ws->cs_check_space(&ctx->dma.cs, num_dw, false) ||
|
||||
ctx->dma.cs.used_vram + ctx->dma.cs.used_gart > 64 * 1024 * 1024 ||
|
||||
ctx->dma.cs.used_vram_kb + ctx->dma.cs.used_gart_kb > 64 * 1024 ||
|
||||
!radeon_cs_memory_below_limit(ctx->screen, &ctx->dma.cs, vram, gtt)) {
|
||||
ctx->dma.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
|
||||
assert((num_dw + ctx->dma.cs.current.cdw) <= ctx->dma.cs.current.max_dw);
|
||||
|
Reference in New Issue
Block a user