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>
This commit is contained in:
Chris Wilson 2011-11-07 20:01:33 +00:00
parent 65a440543b
commit 8e775ceccc
1 changed files with 11 additions and 7 deletions

View File

@ -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;