gallium/radeon: don't flush the GFX IB if DMA doesn't depend on it
authorMarek Olšák <marek.olsak@amd.com>
Thu, 28 Apr 2016 16:06:55 +0000 (18:06 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 10 May 2016 15:20:09 +0000 (17:20 +0200)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c

index 6cbc92bb5f4d543385241e7f4f0afbf897c629a8..a5966d95d97d2efae725c632761e7bc8889b60fc 100644 (file)
@@ -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