Module: Mesa
Branch: master
Commit: 28c7fbbe0fbd5c06db523140929f572e9c6e9dbe
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=28c7fbbe0fbd5c06db523140929f572e9c6e9dbe

Author: Marek Olšák <[email protected]>
Date:   Thu Jul 27 02:45:00 2017 +0200

radeonsi: rely on CLEAR_STATE for clearing UCP and blend color registers

Reviewed-by: Nicolai Hähnle <[email protected]>

---

 src/gallium/drivers/radeonsi/si_hw_context.c | 8 ++++++--
 src/gallium/drivers/radeonsi/si_pipe.h       | 2 ++
 src/gallium/drivers/radeonsi/si_state.c      | 4 ++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index cceb827ab2..92d0cc51dd 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -227,7 +227,9 @@ void si_begin_new_cs(struct si_context *ctx)
        si_mark_atom_dirty(ctx, &ctx->framebuffer.atom);
 
        si_mark_atom_dirty(ctx, &ctx->clip_regs);
-       si_mark_atom_dirty(ctx, &ctx->clip_state.atom);
+       /* CLEAR_STATE sets zeros. */
+       if (ctx->clip_state.any_nonzeros)
+               si_mark_atom_dirty(ctx, &ctx->clip_state.atom);
        ctx->msaa_sample_locs.nr_samples = 0;
        si_mark_atom_dirty(ctx, &ctx->msaa_sample_locs.atom);
        si_mark_atom_dirty(ctx, &ctx->msaa_config);
@@ -235,7 +237,9 @@ void si_begin_new_cs(struct si_context *ctx)
        if (ctx->sample_mask.sample_mask != 0xffff)
                si_mark_atom_dirty(ctx, &ctx->sample_mask.atom);
        si_mark_atom_dirty(ctx, &ctx->cb_render_state);
-       si_mark_atom_dirty(ctx, &ctx->blend_color.atom);
+       /* CLEAR_STATE sets zeros. */
+       if (ctx->blend_color.any_nonzeros)
+               si_mark_atom_dirty(ctx, &ctx->blend_color.atom);
        si_mark_atom_dirty(ctx, &ctx->db_render_state);
        si_mark_atom_dirty(ctx, &ctx->stencil_ref.atom);
        si_mark_atom_dirty(ctx, &ctx->spi_map);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index d25705b0c6..93f1d653e1 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -127,6 +127,7 @@ struct si_screen {
 struct si_blend_color {
        struct r600_atom                atom;
        struct pipe_blend_color         state;
+       bool                            any_nonzeros;
 };
 
 struct si_sampler_view {
@@ -193,6 +194,7 @@ struct si_framebuffer {
 struct si_clip_state {
        struct r600_atom                atom;
        struct pipe_clip_state          state;
+       bool                            any_nonzeros;
 };
 
 struct si_sample_locs {
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 46274dee21..650651d43b 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -631,8 +631,10 @@ static void si_set_blend_color(struct pipe_context *ctx,
                               const struct pipe_blend_color *state)
 {
        struct si_context *sctx = (struct si_context *)ctx;
+       static const struct pipe_blend_color zeros;
 
        sctx->blend_color.state = *state;
+       sctx->blend_color.any_nonzeros = memcmp(state, &zeros, sizeof(*state)) 
!= 0;
        si_mark_atom_dirty(sctx, &sctx->blend_color.atom);
 }
 
@@ -653,11 +655,13 @@ static void si_set_clip_state(struct pipe_context *ctx,
 {
        struct si_context *sctx = (struct si_context *)ctx;
        struct pipe_constant_buffer cb;
+       static const struct pipe_clip_state zeros;
 
        if (memcmp(&sctx->clip_state.state, state, sizeof(*state)) == 0)
                return;
 
        sctx->clip_state.state = *state;
+       sctx->clip_state.any_nonzeros = memcmp(state, &zeros, sizeof(*state)) 
!= 0;
        si_mark_atom_dirty(sctx, &sctx->clip_state.atom);
 
        cb.buffer = NULL;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to