freedreno: Limit max draws per batch
authorRob Clark <robdclark@chromium.org>
Mon, 2 Jan 2023 17:19:49 +0000 (09:19 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 5 Jan 2023 15:44:39 +0000 (15:44 +0000)
Mostly so that piglit drawoverhead doesn't OoM itself with absurd # of
draws.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20496>

src/gallium/drivers/freedreno/freedreno_batch.c

index 3704340..5ed1c1b 100644 (file)
@@ -537,6 +537,11 @@ fd_batch_check_size(struct fd_batch *batch)
       return;
    }
 
+   if (batch->num_draws > 100000) {
+      fd_batch_flush(batch);
+      return;
+   }
+
    /* Place a reasonable upper bound on prim/draw stream buffer size: */
    const unsigned limit_bits = 8 * 8 * 1024 * 1024;
    if ((batch->prim_strm_bits > limit_bits) ||