diff options
author | Marek Olšák <[email protected]> | 2015-08-29 14:54:58 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-09-01 21:51:14 +0200 |
commit | 12b205341acd2d95887099e14a217902fe21a476 (patch) | |
tree | 035b8973bd40845199e897cd0ef221ced92c9dd2 /src/gallium/drivers | |
parent | 0c2eed0edec877584c9362bd9cb9004ff10a8b91 (diff) |
radeonsi: convert clip state into an atom
Reducing calloc overhead.
Reviewed-by: Alex Deucher <[email protected]>
Acked-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_hw_context.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 2 |
4 files changed, 19 insertions, 14 deletions
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c index 561378196b5..689f8166b65 100644 --- a/src/gallium/drivers/radeonsi/si_hw_context.c +++ b/src/gallium/drivers/radeonsi/si_hw_context.c @@ -189,6 +189,7 @@ 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); si_mark_atom_dirty(ctx, &ctx->msaa_sample_locs); si_mark_atom_dirty(ctx, &ctx->msaa_config); si_mark_atom_dirty(ctx, &ctx->db_render_state); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 9be4aa7d5b5..829acf735f6 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -131,6 +131,11 @@ struct si_framebuffer { bool dirty_zsbuf; }; +struct si_clip_state { + struct r600_atom atom; + struct pipe_clip_state state; +}; + struct si_scissors { struct r600_atom atom; unsigned dirty_mask; @@ -184,6 +189,7 @@ struct si_context { struct si_scissors scissors; struct si_viewports viewports; + struct si_clip_state clip_state; struct r600_atom clip_regs; struct r600_atom msaa_sample_locs; struct r600_atom msaa_config; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 3c250484e3a..d3e05b5e024 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -473,22 +473,13 @@ static void si_set_clip_state(struct pipe_context *ctx, const struct pipe_clip_state *state) { struct si_context *sctx = (struct si_context *)ctx; - struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); struct pipe_constant_buffer cb; - if (pm4 == NULL) + if (memcmp(&sctx->clip_state.state, state, sizeof(*state)) == 0) return; - for (int i = 0; i < 6; i++) { - si_pm4_set_reg(pm4, R_0285BC_PA_CL_UCP_0_X + i * 16, - fui(state->ucp[i][0])); - si_pm4_set_reg(pm4, R_0285C0_PA_CL_UCP_0_Y + i * 16, - fui(state->ucp[i][1])); - si_pm4_set_reg(pm4, R_0285C4_PA_CL_UCP_0_Z + i * 16, - fui(state->ucp[i][2])); - si_pm4_set_reg(pm4, R_0285C8_PA_CL_UCP_0_W + i * 16, - fui(state->ucp[i][3])); - } + sctx->clip_state.state = *state; + si_mark_atom_dirty(sctx, &sctx->clip_state.atom); cb.buffer = NULL; cb.user_buffer = state->ucp; @@ -496,8 +487,14 @@ static void si_set_clip_state(struct pipe_context *ctx, cb.buffer_size = 4*4*8; ctx->set_constant_buffer(ctx, PIPE_SHADER_VERTEX, SI_DRIVER_STATE_CONST_BUF, &cb); pipe_resource_reference(&cb.buffer, NULL); +} + +static void si_emit_clip_state(struct si_context *sctx, struct r600_atom *atom) +{ + struct radeon_winsys_cs *cs = sctx->b.rings.gfx.cs; - si_pm4_set_state(sctx, clip, pm4); + r600_write_context_reg_seq(cs, R_0285BC_PA_CL_UCP_0_X, 6*4); + radeon_emit_array(cs, (uint32_t*)sctx->clip_state.state.ucp, 6*4); } #define SIX_BITS 0x3F @@ -3060,6 +3057,7 @@ void si_init_state_functions(struct si_context *sctx) si_init_atom(sctx, &sctx->db_render_state, &sctx->atoms.s.db_render_state, si_emit_db_render_state, 10); si_init_atom(sctx, &sctx->msaa_config, &sctx->atoms.s.msaa_config, si_emit_msaa_config, 10); si_init_atom(sctx, &sctx->clip_regs, &sctx->atoms.s.clip_regs, si_emit_clip_regs, 6); + si_init_atom(sctx, &sctx->clip_state.atom, &sctx->atoms.s.clip_state, si_emit_clip_state, 2+6*4); si_init_atom(sctx, &sctx->scissors.atom, &sctx->atoms.s.scissors, si_emit_scissors, 16*4); si_init_atom(sctx, &sctx->viewports.atom, &sctx->atoms.s.viewports, si_emit_viewports, 16*8); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 8cf308d14da..a8a22eb5dfc 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -84,7 +84,6 @@ union si_state { struct { struct si_state_blend *blend; struct si_pm4_state *blend_color; - struct si_pm4_state *clip; struct si_state_sample_mask *sample_mask; struct si_state_rasterizer *rasterizer; struct si_state_dsa *dsa; @@ -115,6 +114,7 @@ union si_state_atoms { struct r600_atom *db_render_state; struct r600_atom *msaa_config; struct r600_atom *clip_regs; + struct r600_atom *clip_state; struct r600_atom *shader_userdata; struct r600_atom *scissors; struct r600_atom *viewports; |