diff options
author | Marek Olšák <[email protected]> | 2015-08-30 00:50:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-09-01 21:51:14 +0200 |
commit | 45e549fcbc8c2454e242155f0cf4c21360f0b958 (patch) | |
tree | 0745a7cfa3e0383f84fb593fb3abcbce5bffb678 /src/gallium | |
parent | 8a67e78bb8f66a5a142222fdb4d193da1a03ed22 (diff) |
radeonsi: convert CB_TARGET_MASK setup to an atom
Reviewed-by: Alex Deucher <[email protected]>
Acked-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_hw_context.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 23 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 2 |
5 files changed, 13 insertions, 17 deletions
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c index fbac95d5b29..28aed79a0bf 100644 --- a/src/gallium/drivers/radeonsi/si_hw_context.c +++ b/src/gallium/drivers/radeonsi/si_hw_context.c @@ -193,6 +193,7 @@ void si_begin_new_cs(struct si_context *ctx) si_mark_atom_dirty(ctx, &ctx->msaa_sample_locs); si_mark_atom_dirty(ctx, &ctx->msaa_config); si_mark_atom_dirty(ctx, &ctx->sample_mask.atom); + si_mark_atom_dirty(ctx, &ctx->cb_target_mask); 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); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 6eb0cb3bc92..e5d5d10851f 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -203,6 +203,7 @@ struct si_context { struct si_clip_state clip_state; struct r600_atom clip_regs; struct si_sample_mask sample_mask; + struct r600_atom cb_target_mask; struct r600_atom msaa_sample_locs; struct r600_atom msaa_config; int ps_iter_samples; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index d52b9379bad..0c1448eb2d5 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -249,23 +249,18 @@ static unsigned si_pack_float_12p4(float x) * * Another reason is to avoid a hang with dual source blending. */ -void si_update_fb_blend_state(struct si_context *sctx) +static void si_emit_cb_target_mask(struct si_context *sctx, struct r600_atom *atom) { - struct si_pm4_state *pm4; + struct radeon_winsys_cs *cs = sctx->b.rings.gfx.cs; struct si_state_blend *blend = sctx->queued.named.blend; uint32_t mask = 0, i; - if (blend == NULL) - return; - - pm4 = CALLOC_STRUCT(si_pm4_state); - if (pm4 == NULL) - return; - for (i = 0; i < sctx->framebuffer.state.nr_cbufs; i++) if (sctx->framebuffer.state.cbufs[i]) mask |= 0xf << (4*i); - mask &= blend->cb_target_mask; + + if (blend) + mask &= blend->cb_target_mask; /* Avoid a hang that happens when dual source blending is enabled * but there is not enough color outputs. This is undefined behavior, @@ -277,8 +272,7 @@ void si_update_fb_blend_state(struct si_context *sctx) (sctx->ps_shader->ps_colors_written & 0x3) != 0x3) mask = 0; - si_pm4_set_reg(pm4, R_028238_CB_TARGET_MASK, mask); - si_pm4_set_state(sctx, fb_blend, pm4); + r600_write_context_reg(cs, R_028238_CB_TARGET_MASK, mask); } /* @@ -439,7 +433,7 @@ static void si_bind_blend_state(struct pipe_context *ctx, void *state) { struct si_context *sctx = (struct si_context *)ctx; si_pm4_bind_state(sctx, blend, (struct si_state_blend *)state); - si_update_fb_blend_state(sctx); + si_mark_atom_dirty(sctx, &sctx->cb_target_mask); } static void si_delete_blend_state(struct pipe_context *ctx, void *state) @@ -2164,7 +2158,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, } si_update_fb_rs_state(sctx); - si_update_fb_blend_state(sctx); + si_mark_atom_dirty(sctx, &sctx->cb_target_mask); sctx->framebuffer.atom.num_dw = state->nr_cbufs*16 + (8 - state->nr_cbufs)*3; sctx->framebuffer.atom.num_dw += state->zsbuf ? 26 : 4; @@ -3063,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->sample_mask.atom, &sctx->atoms.s.sample_mask, si_emit_sample_mask, 4); + si_init_atom(sctx, &sctx->cb_target_mask, &sctx->atoms.s.cb_target_mask, si_emit_cb_target_mask, 3); si_init_atom(sctx, &sctx->blend_color.atom, &sctx->atoms.s.blend_color, si_emit_blend_color, 6); 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); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 60483db19b5..40be40a6fa4 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -91,7 +91,6 @@ union si_state { struct si_state_rasterizer *rasterizer; struct si_state_dsa *dsa; struct si_pm4_state *fb_rs; - struct si_pm4_state *fb_blend; struct si_pm4_state *ta_bordercolor_base; struct si_pm4_state *ls; struct si_pm4_state *hs; @@ -116,6 +115,7 @@ union si_state_atoms { struct r600_atom *db_render_state; struct r600_atom *msaa_config; struct r600_atom *sample_mask; + struct r600_atom *cb_target_mask; struct r600_atom *blend_color; struct r600_atom *clip_regs; struct r600_atom *clip_state; @@ -269,7 +269,6 @@ void si_init_atom(struct si_context *sctx, struct r600_atom *atom, struct r600_atom **list_elem, void (*emit_func)(struct si_context *ctx, struct r600_atom *state), unsigned num_dw); -void si_update_fb_blend_state(struct si_context *sctx); boolean si_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index af91af97ce8..702af8c803e 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -873,7 +873,7 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state) } sctx->ps_shader = sel; - si_update_fb_blend_state(sctx); + si_mark_atom_dirty(sctx, &sctx->cb_target_mask); } static void si_delete_shader_selector(struct pipe_context *ctx, |