[Mesa-dev] [PATCH 1/5] r600g: unify vgt states

Jerome Glisse j.glisse at gmail.com
Mon Mar 4 07:27:23 PST 2013


On Wed, Feb 27, 2013 at 6:11 PM, Marek Olšák <maraeo at gmail.com> wrote:
> The states were split because we thought it caused a hardlock. Now we know
> the hardlock was caused by something else and has since been fixed.

For the serie:
Reviewed-by: Jerome Glisse <jglisse at redhat.com>

> ---
>  src/gallium/drivers/r600/evergreen_state.c   |    3 +--
>  src/gallium/drivers/r600/r600_hw_context.c   |    1 -
>  src/gallium/drivers/r600/r600_pipe.h         |    6 ------
>  src/gallium/drivers/r600/r600_state.c        |    3 +--
>  src/gallium/drivers/r600/r600_state_common.c |   22 +++++++---------------
>  5 files changed, 9 insertions(+), 26 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index 205bbc5..244989d 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -2615,8 +2615,7 @@ void evergreen_init_state_functions(struct r600_context *rctx)
>         r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_GEOMETRY].views.atom, id++, evergreen_emit_gs_sampler_views, 0);
>         r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views.atom, id++, evergreen_emit_ps_sampler_views, 0);
>
> -       r600_init_atom(rctx, &rctx->vgt_state.atom, id++, r600_emit_vgt_state, 6);
> -       r600_init_atom(rctx, &rctx->vgt2_state.atom, id++, r600_emit_vgt2_state, 3);
> +       r600_init_atom(rctx, &rctx->vgt_state.atom, id++, r600_emit_vgt_state, 7);
>
>         if (rctx->chip_class == EVERGREEN) {
>                 r600_init_atom(rctx, &rctx->sample_mask.atom, id++, evergreen_emit_sample_mask, 3);
> diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
> index 91af6b8..b78b004 100644
> --- a/src/gallium/drivers/r600/r600_hw_context.c
> +++ b/src/gallium/drivers/r600/r600_hw_context.c
> @@ -827,7 +827,6 @@ void r600_begin_new_cs(struct r600_context *ctx)
>         ctx->framebuffer.atom.dirty = true;
>         ctx->poly_offset_state.atom.dirty = true;
>         ctx->vgt_state.atom.dirty = true;
> -       ctx->vgt2_state.atom.dirty = true;
>         ctx->sample_mask.atom.dirty = true;
>         ctx->scissor.atom.dirty = true;
>         ctx->config_state.atom.dirty = true;
> diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
> index 570a284..4cfade1 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -127,10 +127,6 @@ struct r600_vgt_state {
>         struct r600_atom atom;
>         uint32_t vgt_multi_prim_ib_reset_en;
>         uint32_t vgt_multi_prim_ib_reset_indx;
> -};
> -
> -struct r600_vgt2_state {
> -       struct r600_atom atom;
>         uint32_t vgt_indx_offset;
>  };
>
> @@ -506,7 +502,6 @@ struct r600_context {
>         struct r600_config_state        config_state;
>         struct r600_stencil_ref_state   stencil_ref;
>         struct r600_vgt_state           vgt_state;
> -       struct r600_vgt2_state          vgt2_state;
>         struct r600_viewport_state      viewport;
>         /* Shaders and shader resources. */
>         struct r600_cso_state           vertex_fetch_shader;
> @@ -733,7 +728,6 @@ void r600_emit_cso_state(struct r600_context *rctx, struct r600_atom *atom);
>  void r600_emit_alphatest_state(struct r600_context *rctx, struct r600_atom *atom);
>  void r600_emit_blend_color(struct r600_context *rctx, struct r600_atom *atom);
>  void r600_emit_vgt_state(struct r600_context *rctx, struct r600_atom *atom);
> -void r600_emit_vgt2_state(struct r600_context *rctx, struct r600_atom *atom);
>  void r600_emit_clip_misc_state(struct r600_context *rctx, struct r600_atom *atom);
>  void r600_emit_stencil_ref(struct r600_context *rctx, struct r600_atom *atom);
>  void r600_emit_viewport_state(struct r600_context *rctx, struct r600_atom *atom);
> diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
> index bbff6bd..fd3b14e 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -2312,8 +2312,7 @@ void r600_init_state_functions(struct r600_context *rctx)
>         r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views.atom, id++, r600_emit_ps_sampler_views, 0);
>         r600_init_atom(rctx, &rctx->vertex_buffer_state.atom, id++, r600_emit_vertex_buffers, 0);
>
> -       r600_init_atom(rctx, &rctx->vgt_state.atom, id++, r600_emit_vgt_state, 6);
> -       r600_init_atom(rctx, &rctx->vgt2_state.atom, id++, r600_emit_vgt2_state, 3);
> +       r600_init_atom(rctx, &rctx->vgt_state.atom, id++, r600_emit_vgt_state, 7);
>
>         r600_init_atom(rctx, &rctx->seamless_cube_map.atom, id++, r600_emit_seamless_cube_map, 3);
>         r600_init_atom(rctx, &rctx->sample_mask.atom, id++, r600_emit_sample_mask, 3);
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index 4c68506..8906695 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -192,15 +192,9 @@ void r600_emit_vgt_state(struct r600_context *rctx, struct r600_atom *atom)
>         struct r600_vgt_state *a = (struct r600_vgt_state *)atom;
>
>         r600_write_context_reg(cs, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, a->vgt_multi_prim_ib_reset_en);
> -       r600_write_context_reg(cs, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, a->vgt_multi_prim_ib_reset_indx);
> -}
> -
> -void r600_emit_vgt2_state(struct r600_context *rctx, struct r600_atom *atom)
> -{
> -       struct radeon_winsys_cs *cs = rctx->rings.gfx.cs;
> -       struct r600_vgt2_state *a = (struct r600_vgt2_state *)atom;
> -
> -       r600_write_context_reg(cs, R_028408_VGT_INDX_OFFSET, a->vgt_indx_offset);
> +       r600_write_context_reg_seq(cs, R_028408_VGT_INDX_OFFSET, 2);
> +       r600_write_value(cs, a->vgt_indx_offset); /* R_028408_VGT_INDX_OFFSET */
> +       r600_write_value(cs, a->vgt_multi_prim_ib_reset_indx); /* R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX */
>  }
>
>  static void r600_set_clip_state(struct pipe_context *ctx,
> @@ -1371,15 +1365,13 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
>                 info.index_bias = info.start;
>         }
>
> -       /* Set the index offset and multi primitive */
> -       if (rctx->vgt2_state.vgt_indx_offset != info.index_bias) {
> -               rctx->vgt2_state.vgt_indx_offset = info.index_bias;
> -               rctx->vgt2_state.atom.dirty = true;
> -       }
> +       /* Set the index offset and primitive restart. */
>         if (rctx->vgt_state.vgt_multi_prim_ib_reset_en != info.primitive_restart ||
> -           rctx->vgt_state.vgt_multi_prim_ib_reset_indx != info.restart_index) {
> +           rctx->vgt_state.vgt_multi_prim_ib_reset_indx != info.restart_index ||
> +           rctx->vgt_state.vgt_indx_offset != info.index_bias) {
>                 rctx->vgt_state.vgt_multi_prim_ib_reset_en = info.primitive_restart;
>                 rctx->vgt_state.vgt_multi_prim_ib_reset_indx = info.restart_index;
> +               rctx->vgt_state.vgt_indx_offset = info.index_bias;
>                 rctx->vgt_state.atom.dirty = true;
>         }
>
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list