From 8815ac25d9e02007c55e1976732d4060945c8894 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 10 Apr 2014 20:41:57 +0100 Subject: [PATCH] sna/gen2: Fix CA/a8 blend factors This is a revert of commit 142f8461944b294dbc3fb0a7bf607bccf0bccc1f [2.99.911] Author: Chris Wilson Date: Mon Mar 10 15:20:16 2014 +0000 sna/gen2: Tidy blend factor selection for the source as that broke glyph rendering in firefox for instance. Reported-by: Carl Eitsger <4607vrfcr84spd21f08@weg-werf-email.de> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77201 Signed-off-by: Chris Wilson --- src/sna/gen2_render.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index a478817..a6c24f7 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -350,28 +350,39 @@ gen2_get_blend_factors(const struct sna_composite_op *op, cblend = TB0C_LAST_STAGE | TB0C_RESULT_SCALE_1X | TB0C_OUTPUT_WRITE_CURRENT; ablend = TB0A_RESULT_SCALE_1X | TB0A_OUTPUT_WRITE_CURRENT; - /* Get the source picture's channels into TBx_ARG1 */ - if (op->src.is_solid) - cblend |= TB0C_ARG1_SEL_DIFFUSE; - else if (PICT_FORMAT_RGB(op->src.pict_format) != 0) - cblend |= TB0C_ARG1_SEL_TEXEL0; - else - cblend |= TB0C_ARG1_SEL_ONE | TB0C_ARG1_INVERT; /* 0.0 */ - if (op->src.is_solid) - ablend |= TB0A_ARG1_SEL_DIFFUSE; - else if (op->src.is_opaque) - ablend |= TB0A_ARG1_SEL_ONE; - else - ablend |= TB0A_ARG1_SEL_TEXEL0; if ((op->has_component_alpha && gen2_blend_op[blend].src_alpha) || - op->dst.format == PICT_a8) + op->dst.format == PICT_a8) { /* Producing source alpha value, so the first set of channels * is src.A instead of src.X. We also do this if the destination * is a8, in which case src.G is what's written, and the other * channels are ignored. */ - cblend |= TB0C_ARG1_REPLICATE_ALPHA; + if (op->src.is_opaque) { + ablend |= TB0C_ARG1_SEL_ONE; + cblend |= TB0C_ARG1_SEL_ONE; + } else if (op->src.is_solid) { + ablend |= TB0C_ARG1_SEL_DIFFUSE; + cblend |= TB0C_ARG1_SEL_DIFFUSE | TB0C_ARG1_REPLICATE_ALPHA; + } else { + ablend |= TB0C_ARG1_SEL_TEXEL0; + cblend |= TB0C_ARG1_SEL_TEXEL0 | TB0C_ARG1_REPLICATE_ALPHA; + } + } else { + if (op->src.is_solid) + cblend |= TB0C_ARG1_SEL_DIFFUSE; + else if (PICT_FORMAT_RGB(op->src.pict_format) != 0) + cblend |= TB0C_ARG1_SEL_TEXEL0; + else + cblend |= TB0C_ARG1_SEL_ONE | TB0C_ARG1_INVERT; /* 0.0 */ + + if (op->src.is_opaque) + ablend |= TB0A_ARG1_SEL_ONE; + else if (op->src.is_solid) + ablend |= TB0A_ARG1_SEL_DIFFUSE; + else + ablend |= TB0A_ARG1_SEL_TEXEL0; + } if (op->mask.bo) { if (op->src.is_solid) { -- 1.7.9.5