diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-03-10 15:20:16 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-03-10 14:54:53 +0000 |
commit | 142f8461944b294dbc3fb0a7bf607bccf0bccc1f (patch) | |
tree | 1f74432a6baf67e35854f7ea07e33aed26da48af /src/sna/gen2_render.c | |
parent | 0075c90d3192ba90ff1ae8a7b04bfc3ff4fccda7 (diff) |
sna/gen2: Tidy blend factor selection for the source
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen2_render.c')
-rw-r--r-- | src/sna/gen2_render.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 3de0a8fe..18079a8b 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -352,6 +352,18 @@ gen2_get_blend_factors(const struct sna_composite_op *op, /* 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) { /* Producing source alpha value, so the first set of channels @@ -359,27 +371,7 @@ gen2_get_blend_factors(const struct sna_composite_op *op, * is a8, in which case src.G is what's written, and the other * channels are ignored. */ - if (op->src.is_solid) { - ablend |= TB0A_ARG1_SEL_DIFFUSE; - cblend |= TB0C_ARG1_SEL_DIFFUSE | TB0C_ARG1_REPLICATE_ALPHA; - } else { - ablend |= TB0A_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_solid) - ablend |= TB0A_ARG1_SEL_DIFFUSE; - else if (op->src.is_opaque) - ablend |= TB0A_ARG1_SEL_ONE; - else - ablend |= TB0A_ARG1_SEL_TEXEL0; - } + cblend |= TB0C_ARG1_REPLICATE_ALPHA; if (op->mask.bo) { if (op->src.is_solid) { @@ -599,6 +591,7 @@ static void gen2_emit_target(struct sna *sna, const struct sna_composite_op *op) assert(op->dst.bo->pitch >= 8 && op->dst.bo->pitch <= MAX_3D_PITCH); assert(sna->render.vertex_offset == 0); + assert(op->dst.bo->unique_id); if (sna->render_state.gen2.target == op->dst.bo->unique_id) { kgem_bo_mark_dirty(op->dst.bo); return; |