freedreno/a6xx: Fix VFD_CONTROL emit
authorKristian H. Kristensen <hoegsberg@google.com>
Thu, 4 Jun 2020 06:18:52 +0000 (23:18 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 4 Jun 2020 15:50:41 +0000 (15:50 +0000)
The FETCH_CNT field isn't actually the FETCH count. We don't have a
lot of data where it's different from DECODE_CNT, so there's not much
to go by. It could be number of VFD_DEST_CNTL or maybe DECODE_CNT for
binning.  For now, setting both to number of DEST_CNTL gets Google
Earth working again.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5324>

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

index 256860bdfcc160f8e3d0ac00181a1563f3041a8a..a805872638fee550fed03134d35b1c672168524a 100644 (file)
@@ -552,16 +552,12 @@ fd6_emit_combined_textures(struct fd_ringbuffer *ring, struct fd6_emit *emit,
 }
 
 static struct fd_ringbuffer *
-build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp)
+build_vbo_state(struct fd6_emit *emit)
 {
        const struct fd_vertex_state *vtx = emit->vtx;
 
        struct fd_ringbuffer *ring = fd_submit_new_ringbuffer(emit->ctx->batch->submit,
-                       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) |
-                       A6XX_VFD_CONTROL_0_DECODE_CNT(vtx->vtx->num_elements));
+                       4 * (1 + vtx->vertexbuf.count * 4), FD_RINGBUFFER_STREAMING);
 
        OUT_PKT4(ring, REG_A6XX_VFD_FETCH(0), 4 * vtx->vertexbuf.count);
        for (int32_t j = 0; j < vtx->vertexbuf.count; j++) {
@@ -808,13 +804,10 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
                fd6_emit_add_group(emit, vtx->stateobj, FD6_GROUP_VTXSTATE, ENABLE_ALL);
        }
 
-       /* VFD_CONTROL packs both vfd fetch count and vfd decode count, so we have
-        * to emit this if either change.
-        */
-       if (emit->dirty & (FD_DIRTY_VTXBUF | FD_DIRTY_VTXSTATE)) {
+       if (emit->dirty & FD_DIRTY_VTXBUF) {
                struct fd_ringbuffer *state;
 
-               state = build_vbo_state(emit, emit->vs);
+               state = build_vbo_state(emit);
                fd6_emit_take_group(emit, state, FD6_GROUP_VBO, ENABLE_ALL);
        }
 
index 4c0e14c2b88e2e77ba3b5838588a9095a8854ef4..e012746392e770914a978ba4b4aa2026dfe2210b 100644 (file)
@@ -811,6 +811,10 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_screen *screen,
                if (!vs->inputs[i].sysval)
                        non_sysval_input_count++;
 
+       OUT_PKT4(ring, REG_A6XX_VFD_CONTROL_0, 1);
+       OUT_RING(ring, A6XX_VFD_CONTROL_0_FETCH_CNT(non_sysval_input_count) |
+                       A6XX_VFD_CONTROL_0_DECODE_CNT(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);