From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 3eb12f3..4845587 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
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to