summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2014-09-15 15:57:30 +0100
committerRussell King <rmk@arm.linux.org.uk>2015-05-22 15:55:17 +0100
commit3f977f05d0a3b6201ffa72573d0718e0f06901fe (patch)
treeb4652423e51fa9adfcd02dcf69fdfcbb5ff03e1d
parentd0209db029d993035093c406523515a27378b2f6 (diff)
etnaviv: add component alpha blending for PE2.0 hardware
PE2.0 hardware has support for component alpha blending. This is where the blend factors are taken from each individual channel of the other image, rather than the alpha channel of the other image. Hence, a standard InReverse would be: dst.A = src.A * 0 + dst.A * src.A dst.C = src.C * 0 + dst.C * src.A A component alpha InReverse is: dst.A = src.A * 0 + dst.A * src.A dst.C = src.C * 0 + dst.C * src.C This mode is selected by the COLOR and COLOR_INVERSED blend modes. Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r--README6
-rw-r--r--etnaviv/etnaviv_accel.c20
2 files changed, 20 insertions, 6 deletions
diff --git a/README b/README
index 8a2bb03..7fb19c8 100644
--- a/README
+++ b/README
@@ -45,6 +45,6 @@ What operations are accelerated?
- PutImage partially accelerated.
- Solid fills without stipples or partial plane mask.
- FillSpans without stipples or partial plane mask.
-- Xrender compositing without component alpha or alpha maps.
-- Xrender glyph caching and assembling of glyphs (with or without
- component alpha.) - etnaviv only.
+- Xrender compositing without alpha maps, and for PE1.0 hardware, without
+ component alpha.
+- Xrender glyph caching, and rendering of glyphs - etnaviv only.
diff --git a/etnaviv/etnaviv_accel.c b/etnaviv/etnaviv_accel.c
index 8201ef1..d163fc1 100644
--- a/etnaviv/etnaviv_accel.c
+++ b/etnaviv/etnaviv_accel.c
@@ -1185,7 +1185,7 @@ int etnaviv_accel_Composite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
ScreenPtr pScreen = pDst->pDrawable->pScreen;
struct etnaviv *etnaviv = etnaviv_get_screen_priv(pScreen);
struct etnaviv_pixmap *vDst, *vSrc, *vMask, *vTemp = NULL;
- struct etnaviv_blend_op final_op;
+ struct etnaviv_blend_op final_op, mask_op;
PixmapPtr pPixTemp = NULL;
RegionRec region;
BoxRec clip_temp;
@@ -1241,8 +1241,22 @@ int etnaviv_accel_Composite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
if (pMask) {
uint32_t colour;
- if (pMask->componentAlpha)
+ mask_op = etnaviv_composite_op[PictOpInReverse];
+
+ if (VIV_FEATURE(etnaviv->conn, chipMinorFeatures0, 2DPE20)) {
+ /*
+ * PE2.0 can do component alpha blends. Adjust
+ * the mask blend (InReverse) to perform the blend.
+ */
+ mask_op.alpha_mode =
+ VIVS_DE_ALPHA_MODES_GLOBAL_SRC_ALPHA_MODE_NORMAL |
+ VIVS_DE_ALPHA_MODES_GLOBAL_DST_ALPHA_MODE_NORMAL |
+ VIVS_DE_ALPHA_MODES_SRC_BLENDING_MODE(DE_BLENDMODE_ZERO) |
+ VIVS_DE_ALPHA_MODES_DST_BLENDING_MODE(DE_BLENDMODE_COLOR);
+ } else if (pMask->componentAlpha) {
+ /* No support for component alpha blending on PE1.0 */
return FALSE;
+ }
/*
* A PictOpOver with a mask looks like this:
@@ -1476,7 +1490,7 @@ if (pMask && pMask->pDrawable)
xMask, yMask, vMask->pict_format, pMask->format);
#endif
- if (!etnaviv_blend(etnaviv, &clip_temp, &etnaviv_composite_op[PictOpInReverse],
+ if (!etnaviv_blend(etnaviv, &clip_temp, &mask_op,
vTemp, vMask, &clip_temp, 1,
mask_offset, temp_offset))
goto failed;