diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-06 12:00:43 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-06 12:02:19 +0000 |
commit | 800ca0b4d1194544fe2461f91cbdc632c4d3dd7a (patch) | |
tree | 59ee206d232b357b75a7c3bdbcebb8f39233bae1 /src/sna/gen6_render.c | |
parent | b9c9e9970cdb542173e3ed0da2bef614abedd3f7 (diff) |
sna/gen6: Tidy emission of CC state (blending)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen6_render.c')
-rw-r--r-- | src/sna/gen6_render.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 37b10167..bb0aab1f 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -228,7 +228,7 @@ static const struct formatinfo { #define OUT_VERTEX_F(v) vertex_emit(sna, v) static uint32_t gen6_get_blend(int op, - Bool has_component_alpha, + bool has_component_alpha, uint32_t dst_format) { uint32_t src, dst; @@ -570,15 +570,23 @@ gen6_emit_invariant(struct sna *sna) } static bool -gen6_emit_cc(struct sna *sna, uint32_t blend_offset) +gen6_emit_cc(struct sna *sna, + int op, bool has_component_alpha, uint32_t dst_format) { struct gen6_render_state *render = &sna->render_state.gen6; + uint32_t blend; - if (render->blend == blend_offset) + blend = gen6_get_blend(op, has_component_alpha, dst_format); + + DBG(("%s(op=%d, ca=%d, format=%x): new=%x, current=%x\n", + __FUNCTION__, + op, has_component_alpha, dst_format, + blend, render->blend)); + if (render->blend == blend) return false; OUT_BATCH(GEN6_3DSTATE_CC_STATE_POINTERS | (4 - 2)); - OUT_BATCH((render->cc_blend + blend_offset) | 1); + OUT_BATCH((render->cc_blend + blend) | 1); if (render->blend == (unsigned)-1) { OUT_BATCH(1); OUT_BATCH(1); @@ -587,7 +595,7 @@ gen6_emit_cc(struct sna *sna, uint32_t blend_offset) OUT_BATCH(0); } - render->blend = blend_offset; + render->blend = blend; return true; } @@ -804,9 +812,9 @@ gen6_emit_state(struct sna *sna, bool need_flush; need_flush = gen6_emit_cc(sna, - gen6_get_blend(op->op, - op->has_component_alpha, - op->dst.format)); + op->op, + op->has_component_alpha, + op->dst.format); DBG(("%s: sampler src=(%d, %d), mask=(%d, %d), offset=%d\n", __FUNCTION__, @@ -845,9 +853,7 @@ static void gen6_magic_ca_pass(struct sna *sna, DBG(("%s: CA fixup (%d -> %d)\n", __FUNCTION__, sna->render.vertex_start, sna->render.vertex_index)); - need_flush = - gen6_emit_cc(sna, - gen6_get_blend(PictOpAdd, TRUE, op->dst.format)); + need_flush = gen6_emit_cc(sna, PictOpAdd, TRUE, op->dst.format); gen6_emit_wm(sna, gen6_choose_composite_kernel(PictOpAdd, TRUE, TRUE, |