freedreno/a6xx: move blend-color to stateobj
authorRob Clark <robdclark@chromium.org>
Thu, 16 Apr 2020 22:18:08 +0000 (15:18 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 30 Apr 2020 20:03:17 +0000 (20:03 +0000)
To reduce CP overhead for draws skipped in a bin.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>

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

index 9d8ebbca446c95df06dbd7f20d82b6b6bbfdc6fb..ccd59f62876e764fd777291f8427cfdd577c82e1 100644 (file)
@@ -1126,12 +1126,16 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
 
        if (dirty & FD_DIRTY_BLEND_COLOR) {
                struct pipe_blend_color *bcolor = &ctx->blend_color;
+               struct fd_ringbuffer *ring = fd_submit_new_ringbuffer(
+                               emit->ctx->batch->submit, 5*4, FD_RINGBUFFER_STREAMING);
 
                OUT_PKT4(ring, REG_A6XX_RB_BLEND_RED_F32, 4);
                OUT_RING(ring, A6XX_RB_BLEND_RED_F32(bcolor->color[0]));
                OUT_RING(ring, A6XX_RB_BLEND_GREEN_F32(bcolor->color[1]));
                OUT_RING(ring, A6XX_RB_BLEND_BLUE_F32(bcolor->color[2]));
                OUT_RING(ring, A6XX_RB_BLEND_ALPHA_F32(bcolor->color[3]));
+
+               fd6_emit_take_group(emit, ring, FD6_GROUP_BLEND_COLOR, ENABLE_DRAW);
        }
 
        needs_border |= fd6_emit_combined_textures(ring, emit, PIPE_SHADER_VERTEX, vs);
index d0642cb564ef3675525556b749100ae1dbbda3ef..32968c819d5a63eaf44fa43022a3020b5f5ef82b 100644 (file)
@@ -64,6 +64,7 @@ enum fd6_state_id {
        FD6_GROUP_ZSA,
        FD6_GROUP_BLEND,
        FD6_GROUP_SCISSOR,
+       FD6_GROUP_BLEND_COLOR,
 };
 
 #define ENABLE_ALL (CP_SET_DRAW_STATE__0_BINNING | CP_SET_DRAW_STATE__0_GMEM | CP_SET_DRAW_STATE__0_SYSMEM)