freedreno: reduce the upper bound of IB size by one
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Mon, 31 May 2021 08:41:22 +0000 (11:41 +0300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 31 May 2021 17:38:26 +0000 (17:38 +0000)
Going beyond 0x100000 results in hangs, however I found that the
last 0x100000 packet just doesn't get executed. Thus the real limit is
0x0FFFFF. At least this is true for a6xx.

This could be tested by appending nops to the cmdstream and placing
e.g. CP_INTERRUPT at the end, at any position other than being
0x100000 packet it results in a hang.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10786>

src/freedreno/drm/freedreno_ringbuffer.h

index 8e6b3e9..cf47a76 100644 (file)
@@ -173,9 +173,8 @@ fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords)
 {
    assert(ring->funcs->grow); /* unsupported on kgsl */
 
-   /* there is an upper bound on IB size, which appears to be 0x100000 */
-   if (ring->size < 0x100000)
-      ring->size *= 2;
+   /* there is an upper bound on IB size, which appears to be 0x0fffff */
+   ring->size = MIN2(ring->size << 1, 0x0fffff);
 
    ring->funcs->grow(ring, ring->size);
 }