From f0636bc982ed8991a7cc3ca81ed02564965e2b8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 27 Feb 2013 11:00:14 +0100 Subject: [PATCH] r600g: unify vgt states 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. Tested-by: Andreas Boll --- 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 0a3372a..335b691 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -2623,8 +2623,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 da0b02f..453d8f2 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 9a84c1f..f9519d7 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; @@ -734,7 +729,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 c0384e8..1e62afc 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -2313,8 +2313,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 bc11978..b067e50 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, @@ -1381,15 +1375,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; } -- 2.7.4