From 3c268afd296375f678e53fed302eea07a74af741 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 16 Apr 2020 14:33:50 -0700 Subject: [PATCH] freedreno/a6xx: limit PROG_FB_RAST state emit The dependency on RASTERIZER state is only when rasterizer_discard changes. Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 2 +- src/gallium/drivers/freedreno/freedreno_context.h | 6 +++++- src/gallium/drivers/freedreno/freedreno_state.c | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 4fab91c2a51..48f8777d641 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -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); diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 3b422ffca64..b6a8aa3bf5f 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -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: */ diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index 65b1e2b6609..b2e8c53676c 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -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 -- 2.30.2