From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeonsi/si_blit.c   |  2 +-
 src/gallium/drivers/radeonsi/si_gfx_cs.c |  4 ++--
 src/gallium/drivers/radeonsi/si_pipe.c   |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h   | 12 ++----------
 src/gallium/drivers/radeonsi/si_state.c  | 10 +++++-----
 5 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index bbdb5e8f271..bd20a900e69 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -50,21 +50,21 @@ void si_blitter_begin(struct si_context *sctx, enum 
si_blitter_op op)
        util_blitter_save_geometry_shader(sctx->blitter, sctx->gs_shader.cso);
        util_blitter_save_so_targets(sctx->blitter, sctx->streamout.num_targets,
                                     (struct 
pipe_stream_output_target**)sctx->streamout.targets);
        util_blitter_save_rasterizer(sctx->blitter, 
sctx->queued.named.rasterizer);
 
        if (op & SI_SAVE_FRAGMENT_STATE) {
                util_blitter_save_blend(sctx->blitter, 
sctx->queued.named.blend);
                util_blitter_save_depth_stencil_alpha(sctx->blitter, 
sctx->queued.named.dsa);
                util_blitter_save_stencil_ref(sctx->blitter, 
&sctx->stencil_ref.state);
                util_blitter_save_fragment_shader(sctx->blitter, 
sctx->ps_shader.cso);
-               util_blitter_save_sample_mask(sctx->blitter, 
sctx->sample_mask.sample_mask);
+               util_blitter_save_sample_mask(sctx->blitter, sctx->sample_mask);
                util_blitter_save_scissor(sctx->blitter, 
&sctx->scissors.states[0]);
        }
 
        if (op & SI_SAVE_FRAMEBUFFER)
                util_blitter_save_framebuffer(sctx->blitter, 
&sctx->framebuffer.state);
 
        if (op & SI_SAVE_TEXTURES) {
                util_blitter_save_fragment_sampler_states(
                        sctx->blitter, 2,
                        
(void**)sctx->samplers[PIPE_SHADER_FRAGMENT].sampler_states);
diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c 
b/src/gallium/drivers/radeonsi/si_gfx_cs.c
index e864b627a96..1358010c63c 100644
--- a/src/gallium/drivers/radeonsi/si_gfx_cs.c
+++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c
@@ -256,25 +256,25 @@ void si_begin_new_gfx_cs(struct si_context *ctx)
                ctx->framebuffer.dirty_zsbuf = true;
        }
        /* This should always be marked as dirty to set the framebuffer scissor
         * at least. */
        si_mark_atom_dirty(ctx, &ctx->atoms.s.framebuffer);
 
        si_mark_atom_dirty(ctx, &ctx->atoms.s.clip_regs);
        /* CLEAR_STATE sets zeros. */
        if (!has_clear_state || ctx->clip_state.any_nonzeros)
                si_mark_atom_dirty(ctx, &ctx->atoms.s.clip_state);
-       ctx->msaa_sample_locs.nr_samples = 0;
+       ctx->sample_locs_num_samples = 0;
        si_mark_atom_dirty(ctx, &ctx->atoms.s.msaa_sample_locs);
        si_mark_atom_dirty(ctx, &ctx->atoms.s.msaa_config);
        /* CLEAR_STATE sets 0xffff. */
-       if (!has_clear_state || ctx->sample_mask.sample_mask != 0xffff)
+       if (!has_clear_state || ctx->sample_mask != 0xffff)
                si_mark_atom_dirty(ctx, &ctx->atoms.s.sample_mask);
        si_mark_atom_dirty(ctx, &ctx->atoms.s.cb_render_state);
        /* CLEAR_STATE sets zeros. */
        if (!has_clear_state || ctx->blend_color.any_nonzeros)
                si_mark_atom_dirty(ctx, &ctx->atoms.s.blend_color);
        si_mark_atom_dirty(ctx, &ctx->atoms.s.db_render_state);
        if (ctx->chip_class >= GFX9)
                si_mark_atom_dirty(ctx, &ctx->atoms.s.dpbb_state);
        si_mark_atom_dirty(ctx, &ctx->atoms.s.stencil_ref);
        si_mark_atom_dirty(ctx, &ctx->atoms.s.spi_map);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index c5466bda9f8..abe7dd51eb4 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -465,21 +465,21 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
 
        if (sscreen->debug_flags & DBG(FORCE_DMA))
                sctx->b.resource_copy_region = sctx->dma_copy;
 
        sctx->blitter = util_blitter_create(&sctx->b);
        if (sctx->blitter == NULL)
                goto fail;
        sctx->blitter->draw_rectangle = si_draw_rectangle;
        sctx->blitter->skip_viewport_restore = true;
 
-       sctx->sample_mask.sample_mask = 0xffff;
+       sctx->sample_mask = 0xffff;
 
        /* these must be last */
        si_begin_new_gfx_cs(sctx);
 
        if (sctx->chip_class >= GFX9) {
                sctx->wait_mem_scratch = (struct r600_resource*)
                        pipe_buffer_create(screen, 0, PIPE_USAGE_DEFAULT, 4);
                if (!sctx->wait_mem_scratch)
                        goto fail;
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 41f88b9688e..eef8e602fad 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -629,28 +629,20 @@ struct si_viewports {
        unsigned                        depth_range_dirty_mask;
        struct pipe_viewport_state      states[SI_MAX_VIEWPORTS];
        struct si_signed_scissor        as_scissor[SI_MAX_VIEWPORTS];
 };
 
 struct si_clip_state {
        struct pipe_clip_state          state;
        bool                            any_nonzeros;
 };
 
-struct si_sample_locs {
-       unsigned                nr_samples;
-};
-
-struct si_sample_mask {
-       uint16_t                sample_mask;
-};
-
 struct si_streamout_target {
        struct pipe_stream_output_target b;
 
        /* The buffer where BUFFER_FILLED_SIZE is stored. */
        struct r600_resource    *buf_filled_size;
        unsigned                buf_filled_size_offset;
        bool                    buf_filled_size_valid;
 
        unsigned                stride_in_dw;
 };
@@ -808,22 +800,22 @@ struct si_context {
        /* Atoms (direct states). */
        union si_state_atoms            atoms;
        unsigned                        dirty_atoms; /* mask */
        /* PM4 states (precomputed immutable states) */
        unsigned                        dirty_states;
        union si_state                  queued;
        union si_state                  emitted;
 
        /* Atom declarations. */
        struct si_framebuffer           framebuffer;
-       struct si_sample_locs           msaa_sample_locs;
-       struct si_sample_mask           sample_mask;
+       unsigned                        sample_locs_num_samples;
+       uint16_t                        sample_mask;
        unsigned                        last_cb_target_mask;
        struct si_blend_color           blend_color;
        struct si_clip_state            clip_state;
        struct si_shader_data           shader_pointers;
        struct si_stencil_ref           stencil_ref;
        struct si_scissors              scissors;
        struct si_streamout             streamout;
        struct si_viewports             viewports;
 
        /* Precomputed states. */
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 78ca1f436c9..928b465fe25 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3202,22 +3202,22 @@ static void si_emit_msaa_sample_locs(struct si_context 
*sctx,
         */
        if (nr_samples <= 1 && sctx->smoothing_enabled)
                nr_samples = SI_NUM_SMOOTH_AA_SAMPLES;
 
        /* On Polaris, the small primitive filter uses the sample locations
         * even when MSAA is off, so we need to make sure they're set to 0.
         */
        if (has_msaa_sample_loc_bug)
                nr_samples = MAX2(nr_samples, 1);
 
-       if (nr_samples != sctx->msaa_sample_locs.nr_samples) {
-               sctx->msaa_sample_locs.nr_samples = nr_samples;
+       if (nr_samples != sctx->sample_locs_num_samples) {
+               sctx->sample_locs_num_samples = nr_samples;
                si_emit_sample_locations(cs, nr_samples);
        }
 
        if (sctx->family >= CHIP_POLARIS10) {
                struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
                unsigned small_prim_filter_cntl =
                        S_028830_SMALL_PRIM_FILTER_ENABLE(1) |
                        /* line bug */
                        S_028830_LINE_FILTER_DISABLE(sctx->family <= 
CHIP_POLARIS12);
 
@@ -4144,31 +4144,31 @@ static void *si_create_sampler_state(struct 
pipe_context *ctx,
                        si_translate_border_color(sctx, state, 
&clamped_border_color, false) |
                        S_008F3C_UPGRADED_DEPTH(1);
 
        return rstate;
 }
 
 static void si_set_sample_mask(struct pipe_context *ctx, unsigned sample_mask)
 {
        struct si_context *sctx = (struct si_context *)ctx;
 
-       if (sctx->sample_mask.sample_mask == (uint16_t)sample_mask)
+       if (sctx->sample_mask == (uint16_t)sample_mask)
                return;
 
-       sctx->sample_mask.sample_mask = sample_mask;
+       sctx->sample_mask = sample_mask;
        si_mark_atom_dirty(sctx, &sctx->atoms.s.sample_mask);
 }
 
 static void si_emit_sample_mask(struct si_context *sctx, struct si_atom *atom)
 {
        struct radeon_winsys_cs *cs = sctx->gfx_cs;
-       unsigned mask = sctx->sample_mask.sample_mask;
+       unsigned mask = sctx->sample_mask;
 
        /* Needed for line and polygon smoothing as well as for the Polaris
         * small primitive filter. We expect the state tracker to take care of
         * this for us.
         */
        assert(mask == 0xffff || sctx->framebuffer.nr_samples > 1 ||
               (mask & 1 && sctx->blitter->running));
 
        radeon_set_context_reg_seq(cs, R_028C38_PA_SC_AA_MASK_X0Y0_X1Y0, 2);
        radeon_emit(cs, mask | (mask << 16));
-- 
2.17.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to