From de8be1de132085c434532f3dc0d1c456109a8f2a Mon Sep 17 00:00:00 2001 From: "Kristian H. Kristensen" Date: Wed, 3 Jun 2020 23:18:52 -0700 Subject: [PATCH] freedreno/a6xx: Fix VFD_CONTROL emit 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: --- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 15 ++++----------- src/gallium/drivers/freedreno/a6xx/fd6_program.c | 4 ++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 256860bdfcc..a805872638f 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index 4c0e14c2b88..e012746392e 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -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); -- 2.30.2