From 3c402d0dc2a39a7d6efd51400d3cab5b737dfafc Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 25 Oct 2018 15:27:10 -0400 Subject: [PATCH] freedreno/a6xx: disable unused groups Don't leave vsconst/fsconst group enabled if we switch to shader with no uniforms. Fixes: abcdf5627a2 freedreno/a6xx: move const emit to state group Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 17 +++++++++++++---- src/gallium/drivers/freedreno/a6xx/fd6_emit.h | 2 -- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index ae91e90e4a1..8c3336d5ea6 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -954,10 +954,19 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) struct fd6_state_group *g = &emit->groups[i]; unsigned n = fd_ringbuffer_size(g->stateobj) / 4; - OUT_RING(ring, CP_SET_DRAW_STATE__0_COUNT(n) | - CP_SET_DRAW_STATE__0_ENABLE_MASK(g->enable_mask) | - CP_SET_DRAW_STATE__0_GROUP_ID(g->group_id)); - OUT_RB(ring, g->stateobj); + if (n == 0) { + OUT_RING(ring, CP_SET_DRAW_STATE__0_COUNT(0) | + CP_SET_DRAW_STATE__0_DISABLE | + CP_SET_DRAW_STATE__0_ENABLE_MASK(g->enable_mask) | + CP_SET_DRAW_STATE__0_GROUP_ID(g->group_id)); + OUT_RING(ring, 0x00000000); + OUT_RING(ring, 0x00000000); + } else { + OUT_RING(ring, CP_SET_DRAW_STATE__0_COUNT(n) | + CP_SET_DRAW_STATE__0_ENABLE_MASK(g->enable_mask) | + CP_SET_DRAW_STATE__0_GROUP_ID(g->group_id)); + OUT_RB(ring, g->stateobj); + } fd_ringbuffer_del(g->stateobj); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h index d7ab80ae7a4..dce131d6b27 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h @@ -110,8 +110,6 @@ fd6_emit_add_group(struct fd6_emit *emit, struct fd_ringbuffer *stateobj, enum fd6_state_id group_id, unsigned enable_mask) { debug_assert(emit->num_groups < ARRAY_SIZE(emit->groups)); - if (fd_ringbuffer_size(stateobj) == 0) - return; struct fd6_state_group *g = &emit->groups[emit->num_groups++]; g->stateobj = fd_ringbuffer_ref(stateobj); g->group_id = group_id; -- 2.30.2