freedreno/a6xx: disable unused groups
authorRob Clark <robdclark@gmail.com>
Thu, 25 Oct 2018 19:27:10 +0000 (15:27 -0400)
committerRob Clark <robdclark@gmail.com>
Thu, 25 Oct 2018 22:38:53 +0000 (18:38 -0400)
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 <robdclark@gmail.com>
src/gallium/drivers/freedreno/a6xx/fd6_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_emit.h

index ae91e90e4a1b14d23abf46ba34fd549fc24a50a1..8c3336d5ea6bca0b8ce0f537e0dd53932ae908ca 100644 (file)
@@ -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);
                }
index d7ab80ae7a46ccf3234518fb56486aa792b9f966..dce131d6b273e18173e6ac6a83c557064306a452 100644 (file)
@@ -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;