From: Marek Olšák Date: Thu, 27 Jul 2017 00:45:00 +0000 (+0200) Subject: radeonsi: rely on CLEAR_STATE for clearing UCP and blend color registers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28c7fbbe0fbd5c06db523140929f572e9c6e9dbe;p=mesa.git radeonsi: rely on CLEAR_STATE for clearing UCP and blend color registers Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c index cceb827ab25..92d0cc51dd6 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 d25705b0c60..93f1d653e13 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 46274dee21e..650651d43b9 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;