From: Kristian H. Kristensen Date: Thu, 21 May 2020 08:26:02 +0000 (-0700) Subject: freedreno/a6xx: Program VFD_DEST_CNTL from program stateobj X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6f7bc2979926faff3abecfb52533e7043fc05a5;p=mesa.git freedreno/a6xx: Program VFD_DEST_CNTL from program stateobj This only depends on the generated shader. Part-of: --- diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 9f281893dcd..cdc8dfb85bd 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -556,19 +556,8 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp) { const struct fd_vertex_state *vtx = emit->vtx; - /* Determine which inputs need VFD state */ - int32_t map[32]; - int32_t cnt = 0; - for (int32_t i = 0; i <= vp->inputs_count; i++) { - if (vp->inputs[i].sysval) - continue; - if (vp->inputs[i].compmask) { - map[cnt++] = i; - } - } - struct fd_ringbuffer *ring = fd_submit_new_ringbuffer(emit->ctx->batch->submit, - 4 * (5 + cnt * 3 + vtx->vertexbuf.count * 4), FD_RINGBUFFER_STREAMING); + 4 * (3 + vtx->vertexbuf.count * 4), FD_RINGBUFFER_STREAMING); OUT_PKT4(ring, REG_A6XX_VFD_CONTROL_0, 1); OUT_RING(ring, A6XX_VFD_CONTROL_0_FETCH_CNT(vtx->vertexbuf.count) | @@ -593,13 +582,7 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp) } } - OUT_PKT4(ring, REG_A6XX_VFD_DEST_CNTL(0), cnt); - for (int32_t j = 0; j < cnt; j++) { - int32_t i = map[j]; - - OUT_RING(ring, A6XX_VFD_DEST_CNTL_INSTR_WRITEMASK(vp->inputs[i].compmask) | - A6XX_VFD_DEST_CNTL_INSTR_REGID(vp->inputs[i].regid)); - } + return ring; } static struct fd_ringbuffer * diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index 24c8ab080e2..98774a2cfe5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -806,6 +806,18 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_screen *screen, OUT_PKT4(ring, REG_A6XX_PC_PRIMID_CNTL, 1); OUT_RING(ring, COND(primid_passthru, A6XX_PC_PRIMID_CNTL_PRIMID_PASSTHRU)); + uint32_t non_sysval_input_count = 0; + for (uint32_t i = 0; i < vs->inputs_count; i++) + if (!vs->inputs[i].sysval) + non_sysval_input_count++; + + OUT_PKT4(ring, REG_A6XX_VFD_DEST_CNTL(0), non_sysval_input_count); + for (uint32_t i = 0; i < non_sysval_input_count; i++) { + assert(vs->inputs[i].compmask); + OUT_RING(ring, A6XX_VFD_DEST_CNTL_INSTR_WRITEMASK(vs->inputs[i].compmask) | + A6XX_VFD_DEST_CNTL_INSTR_REGID(vs->inputs[i].regid)); + } + OUT_PKT4(ring, REG_A6XX_VFD_CONTROL_1, 6); OUT_RING(ring, A6XX_VFD_CONTROL_1_REGID4VTX(vertex_regid) | A6XX_VFD_CONTROL_1_REGID4INST(instance_regid) |