From: Marek Olšák Date: Thu, 28 Apr 2016 16:06:55 +0000 (+0200) Subject: gallium/radeon: don't flush the GFX IB if DMA doesn't depend on it X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b58bc44615c2ac61a0ff35cc69c8aae2b501083;p=mesa.git gallium/radeon: don't flush the GFX IB if DMA doesn't depend on it Reviewed-by: Alex Deucher Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 6cbc92bb5f4..a5966d95d97 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -154,8 +154,14 @@ void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw, gtt += src->buf->size; } - /* Flush the GFX IB if it's not empty. */ - if (ctx->gfx.cs->cdw > ctx->initial_gfx_cs_size) + /* Flush the GFX IB if DMA depends on it. */ + if (ctx->gfx.cs->cdw > ctx->initial_gfx_cs_size && + ((dst && + ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, dst->buf, + RADEON_USAGE_READWRITE)) || + (src && + ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, src->buf, + RADEON_USAGE_WRITE)))) ctx->gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL); /* Flush if there's not enough space, or if the memory usage per IB