From 5f494636faf00ac5a2f6e88b0100c642fc04536a Mon Sep 17 00:00:00 2001 From: "Kristian H. Kristensen" Date: Fri, 15 May 2020 14:52:01 -0700 Subject: [PATCH] freedreno/a6xx: Allocate ringbuffer based on VFD count Part-of: --- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index aad89e9d35c..6105fcd8cfd 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -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; } -- 2.30.2