freedreno/a6xx: Allocate ringbuffer based on VFD count
authorKristian H. Kristensen <hoegsberg@google.com>
Fri, 15 May 2020 21:52:01 +0000 (14:52 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 May 2020 00:16:55 +0000 (00:16 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5064>

src/gallium/drivers/freedreno/a6xx/fd6_emit.c

index aad89e9d35c7f95a27b3baa817d62f7d09c87eb7..6105fcd8cfdd0208c57f066d466b1f26ebe80eea 100644 (file)
@@ -556,9 +556,6 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp)
 {
        const struct fd_vertex_state *vtx = emit->vtx;
 
-       struct fd_ringbuffer *ring = fd_submit_new_ringbuffer(emit->ctx->batch->submit,
-                       4 * (10 * vp->inputs_count + 2), FD_RINGBUFFER_STREAMING);
-
        /* Determine which inputs need VFD state */
        int32_t map[32];
        int32_t cnt = 0;
@@ -570,6 +567,13 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp)
                }
        }
 
+       struct fd_ringbuffer *ring = fd_submit_new_ringbuffer(emit->ctx->batch->submit,
+                       4 * (2 + cnt * 10), FD_RINGBUFFER_STREAMING);
+
+       OUT_PKT4(ring, REG_A6XX_VFD_CONTROL_0, 1);
+       OUT_RING(ring, A6XX_VFD_CONTROL_0_FETCH_CNT(cnt) |
+                       A6XX_VFD_CONTROL_0_DECODE_CNT(cnt));
+
        for (int32_t j = 0; j < cnt; j++) {
                int32_t i = map[j];
                struct pipe_vertex_element *elem = &vtx->vtx->pipe[i];
@@ -609,10 +613,6 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp)
                                A6XX_VFD_DEST_CNTL_INSTR_REGID(vp->inputs[i].regid));
        }
 
-       OUT_PKT4(ring, REG_A6XX_VFD_CONTROL_0, 1);
-       OUT_RING(ring, A6XX_VFD_CONTROL_0_FETCH_CNT(cnt) |
-                       A6XX_VFD_CONTROL_0_DECODE_CNT(cnt));
-
        return ring;
 }