freedreno/a6xx: limit PROG_FB_RAST state emit
authorRob Clark <robdclark@chromium.org>
Thu, 16 Apr 2020 21:33:50 +0000 (14:33 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 30 Apr 2020 20:03:17 +0000 (20:03 +0000)
The dependency on RASTERIZER state is only when rasterizer_discard
changes.

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/freedreno_context.h
src/gallium/drivers/freedreno/freedreno_state.c

index 4fab91c2a5183c65875965edfc1271bdfd8c5e4f..48f8777d641efe0e31069340f786bf61151e9246 100644 (file)
@@ -1053,7 +1053,7 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
                                                   FD6_GROUP_RASTERIZER, ENABLE_ALL);
        }
 
-       if (dirty & (FD_DIRTY_FRAMEBUFFER | FD_DIRTY_RASTERIZER | FD_DIRTY_PROG)) {
+       if (dirty & (FD_DIRTY_FRAMEBUFFER | FD_DIRTY_RASTERIZER_DISCARD | FD_DIRTY_PROG)) {
                struct fd_ringbuffer *ring = fd_submit_new_ringbuffer(
                                emit->ctx->batch->submit, 5 * 4, FD_RINGBUFFER_STREAMING);
 
index 3b422ffca649bff7b518778e60ea1c10778839aa..b6a8aa3bf5f8a298f35ccf4ddee25ce410ca65ef 100644 (file)
@@ -131,7 +131,6 @@ enum fd_dirty_3d_state {
        FD_DIRTY_VTXSTATE    = BIT(9),
        FD_DIRTY_VTXBUF      = BIT(10),
        FD_DIRTY_MIN_SAMPLES = BIT(11),
-
        FD_DIRTY_SCISSOR     = BIT(12),
        FD_DIRTY_STREAMOUT   = BIT(13),
        FD_DIRTY_UCP         = BIT(14),
@@ -148,6 +147,11 @@ enum fd_dirty_3d_state {
 
        /* only used by a2xx.. possibly can be removed.. */
        FD_DIRTY_TEXSTATE    = BIT(21),
+
+       /* fine grained state changes, for cases where state is not orthogonal
+        * from hw perspective:
+        */
+       FD_DIRTY_RASTERIZER_DISCARD = BIT(24),
 };
 
 /* per shader-stage dirty state: */
index 65b1e2b6609be54f87939f5cb4a8406ffa0f9f9f..b2e8c53676c3c85e227f5ffd8ef67f9849d9df5a 100644 (file)
@@ -395,6 +395,7 @@ fd_rasterizer_state_bind(struct pipe_context *pctx, void *hwcso)
 {
        struct fd_context *ctx = fd_context(pctx);
        struct pipe_scissor_state *old_scissor = fd_context_get_scissor(ctx);
+       bool discard = ctx->rasterizer && ctx->rasterizer->rasterizer_discard;
 
        ctx->rasterizer = hwcso;
        ctx->dirty |= FD_DIRTY_RASTERIZER;
@@ -406,6 +407,9 @@ fd_rasterizer_state_bind(struct pipe_context *pctx, void *hwcso)
         */
        if (old_scissor != fd_context_get_scissor(ctx))
                ctx->dirty |= FD_DIRTY_SCISSOR;
+
+       if (ctx->rasterizer && (discard != ctx->rasterizer->rasterizer_discard))
+               ctx->dirty |= FD_DIRTY_RASTERIZER_DISCARD;
 }
 
 static void