radeonsi: use num_cs_dw_queries_suspend
authorMarek Olšák <marek.olsak@amd.com>
Sun, 1 Apr 2018 17:40:41 +0000 (13:40 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 5 Apr 2018 19:34:58 +0000 (15:34 -0400)
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/radeonsi/si_hw_context.c

index 6fc85eacb3a2aeca9216ad8725259f6f7098997e..eb9e16c229f86a583a9537c7eefa10b021f0b29a 100644 (file)
@@ -59,10 +59,14 @@ void si_need_cs_space(struct si_context *ctx)
        ctx->b.gtt = 0;
        ctx->b.vram = 0;
 
-       /* If the CS is sufficiently large, don't count the space needed
+       /* If the IB is sufficiently large, don't count the space needed
         * and just flush if there is not enough space left.
+        *
+        * Also reserve space for stopping queries at the end of IB, because
+        * the number of active queries is mostly unlimited.
         */
-       if (!ctx->b.ws->cs_check_space(cs, 2048))
+       unsigned need_dwords = 2048 + ctx->b.num_cs_dw_queries_suspend;
+       if (!ctx->b.ws->cs_check_space(cs, need_dwords))
                si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
 }