radeonsi: fix memory usage checking for big IBs
authorMarek Olšák <marek.olsak@amd.com>
Sun, 30 Aug 2015 01:44:03 +0000 (03:44 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 1 Sep 2015 19:51:13 +0000 (21:51 +0200)
Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
src/gallium/drivers/radeonsi/si_hw_context.c

index 110e3163021044cc11de5a14882a854f0939e5ea..563251ddd4b138d6bca03cf2abd039b71ec8cdf5 100644 (file)
@@ -33,14 +33,6 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
        struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
        int i;
 
-       /* If the CS is sufficiently large, don't count the space needed
-        * and just flush if there is less than 8096 dwords left. */
-       if (cs->max_dw >= 24 * 1024) {
-               if (cs->cdw > cs->max_dw - 8 * 1024)
-                       ctx->b.rings.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
-               return;
-       }
-
        /* There are two memory usage counters in the winsys for all buffers
         * that have been added (cs_add_reloc) and two counters in the pipe
         * driver for those that haven't been added yet.
@@ -54,6 +46,15 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
        ctx->b.gtt = 0;
        ctx->b.vram = 0;
 
+       /* If the CS is sufficiently large, don't count the space needed
+        * and just flush if there is less than 8096 dwords left.
+        */
+       if (cs->max_dw >= 24 * 1024) {
+               if (cs->cdw > cs->max_dw - 8 * 1024)
+                       ctx->b.rings.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
+               return;
+       }
+
        /* The number of dwords we already used in the CS so far. */
        num_dw += cs->cdw;