radeonsi: use local ws variable in si_need_dma_space
authorMarek Olšák <marek.olsak@amd.com>
Thu, 31 Jan 2019 15:59:48 +0000 (10:59 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 6 Feb 2019 16:17:21 +0000 (11:17 -0500)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_dma_cs.c

index 33177a9e4adf0a14f492d53d939974eb7d1323b4..2aafc1f09a0e0f17251d4bae07cd301bc240cb89 100644 (file)
@@ -126,6 +126,7 @@ void si_sdma_clear_buffer(struct si_context *sctx, struct pipe_resource *dst,
 void si_need_dma_space(struct si_context *ctx, unsigned num_dw,
                       struct si_resource *dst, struct si_resource *src)
 {
+       struct radeon_winsys *ws = ctx->ws;
        uint64_t vram = ctx->dma_cs->used_vram;
        uint64_t gtt = ctx->dma_cs->used_gart;
 
@@ -141,11 +142,11 @@ void si_need_dma_space(struct si_context *ctx, unsigned num_dw,
        /* Flush the GFX IB if DMA depends on it. */
        if (radeon_emitted(ctx->gfx_cs, ctx->initial_gfx_cs_size) &&
            ((dst &&
-             ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs, dst->buf,
-                                                RADEON_USAGE_READWRITE)) ||
+             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))))
+             ws->cs_is_buffer_referenced(ctx->gfx_cs, src->buf,
+                                         RADEON_USAGE_WRITE))))
                si_flush_gfx_cs(ctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
 
        /* Flush if there's not enough space, or if the memory usage per IB
@@ -161,7 +162,7 @@ void si_need_dma_space(struct si_context *ctx, unsigned num_dw,
         * engine busy while uploads are being submitted.
         */
        num_dw++; /* for emit_wait_idle below */
-       if (!ctx->ws->cs_check_space(ctx->dma_cs, num_dw) ||
+       if (!ws->cs_check_space(ctx->dma_cs, num_dw) ||
            ctx->dma_cs->used_vram + ctx->dma_cs->used_gart > 64 * 1024 * 1024 ||
            !radeon_cs_memory_below_limit(ctx->screen, ctx->dma_cs, vram, gtt)) {
                si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
@@ -172,11 +173,11 @@ void si_need_dma_space(struct si_context *ctx, unsigned num_dw,
         * prevent read-after-write hazards.
         */
        if ((dst &&
-            ctx->ws->cs_is_buffer_referenced(ctx->dma_cs, dst->buf,
-                                               RADEON_USAGE_READWRITE)) ||
+            ws->cs_is_buffer_referenced(ctx->dma_cs, dst->buf,
+                                        RADEON_USAGE_READWRITE)) ||
            (src &&
-            ctx->ws->cs_is_buffer_referenced(ctx->dma_cs, src->buf,
-                                               RADEON_USAGE_WRITE)))
+            ws->cs_is_buffer_referenced(ctx->dma_cs, src->buf,
+                                        RADEON_USAGE_WRITE)))
                si_dma_emit_wait_idle(ctx);
 
        if (dst) {