diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-07 20:01:33 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-07 20:09:31 +0000 |
commit | 8e775cecccebe543d344721d45b2d43ee9f122b3 (patch) | |
tree | 7a76ff7ab96072f99c7ba937d7028f7c8fbe43b8 | |
parent | 65a440543b13e3e605a4a2d6209a460fbbe55736 (diff) |
sna/gen3: Fix false reduction of ComponentAlpha with white source
The principle behind the opertator reduction of WHITE * maskca is valid,
except that we failed to account for the src/mask transposition when
emitting the vertices - garbage ensued.
Given that we agressively reduce the shader required for WHITE * maskca,
it does not seem worthwhile to special case the primitive emitter as
well.
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42676
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/gen3_render.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 54396728..c8ad2096 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -1078,7 +1078,6 @@ gen3_composite_emit_shader(struct sna *sna, */ if (op->has_component_alpha) { switch (src->u.gen3.type) { - case SHADER_WHITE: case SHADER_BLACK: if (gen3_blend_op[blend].src_alpha) gen3_fs_mov(out_reg, @@ -1087,6 +1086,10 @@ gen3_composite_emit_shader(struct sna *sna, gen3_fs_mov(out_reg, gen3_fs_operand(mask_reg, ZERO, ZERO, ZERO, W)); break; + case SHADER_WHITE: + gen3_fs_mov(out_reg, + gen3_fs_operand_reg(mask_reg)); + break; default: if (gen3_blend_op[blend].src_alpha) gen3_fs_mul(out_reg, @@ -1853,6 +1856,9 @@ gen3_init_solid(struct sna_composite_channel *channel, uint32_t color) channel->alpha_fixup = 0; channel->rb_reversed = 0; + DBG(("%s: color=%08x, is_opaque=%d, type=%d\n", + __FUNCTION__, color, channel->is_opaque, channel->u.gen3.type)); + /* for consistency */ channel->repeat = RepeatNormal; channel->filter = PictFilterNearest; @@ -2182,7 +2188,10 @@ reduce_damage(struct sna_composite_op *op, r.y1 = dst_y + op->dst.y; r.y2 = r.y1 + height; - if (sna_damage_contains_box(*op->damage, &r) == PIXMAN_REGION_IN) + if (sna_damage_is_all(op->damage, + op->dst.pixmap->drawable.width, + op->dst.pixmap->drawable.width) || + sna_damage_contains_box(*op->damage, &r) == PIXMAN_REGION_IN) op->damage = NULL; } @@ -2378,11 +2387,6 @@ gen3_render_composite(struct sna *sna, if (tmp->mask.u.gen3.type == SHADER_WHITE) { tmp->mask.u.gen3.type = SHADER_NONE; tmp->has_component_alpha = FALSE; - } else if (tmp->src.u.gen3.type == SHADER_WHITE) { - tmp->src = tmp->mask; - tmp->mask.u.gen3.type = SHADER_NONE; - tmp->mask.bo = NULL; - tmp->has_component_alpha = FALSE; } else if (is_constant_ps(tmp->src.u.gen3.type) && is_constant_ps(tmp->mask.u.gen3.type)) { uint32_t a,r,g,b; |