diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-12 23:28:51 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-13 17:45:05 +0000 |
commit | c9668a772f15ab36d643a9b0616b309856146c89 (patch) | |
tree | 73ccaab29928f3970c2351c71f065a945135a94c | |
parent | 2ea58256f5ce6e1c0f48d366ff7a1fbf300600de (diff) |
sna: Reduce OVER with a clear pixmap to a BLT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 7 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 12 | ||||
-rw-r--r-- | src/sna/sna_trapezoids.c | 7 |
3 files changed, 17 insertions, 9 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 441b24e5..6ec47485 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -460,6 +460,13 @@ sna_drawable_move_to_gpu(DrawablePtr drawable, unsigned flags) return sna_pixmap_move_to_gpu(get_drawable_pixmap(drawable), flags) != NULL; } +static inline bool +sna_drawable_is_clear(DrawablePtr d) +{ + struct sna_pixmap *priv = sna_pixmap(get_drawable_pixmap(d)); + return priv && priv->clear && priv->clear_color == 0; +} + static inline struct kgem_bo *sna_pixmap_get_bo(PixmapPtr pixmap) { return sna_pixmap(pixmap)->gpu_bo; diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index eb8dbf87..e7a6182f 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -1556,6 +1556,7 @@ sna_blt_composite(struct sna *sna, struct sna_pixmap *priv; int16_t tx, ty; uint32_t alpha_fixup; + bool was_clear; Bool ret; #if DEBUG_NO_BLT || NO_BLT_COMPOSITE @@ -1576,6 +1577,7 @@ sna_blt_composite(struct sna *sna, return FALSE; } + was_clear = sna_drawable_is_clear(dst->pDrawable); tmp->dst.pixmap = get_drawable_pixmap(dst->pDrawable); priv = sna_pixmap_move_to_gpu(tmp->dst.pixmap, MOVE_WRITE | MOVE_READ); if (priv == NULL) { @@ -1606,16 +1608,22 @@ sna_blt_composite(struct sna *sna, _kgem_set_mode(&sna->kgem, KGEM_BLT); } - if (op == PictOpClear) + if (op == PictOpClear) { +clear: + if (was_clear) + return TRUE; return prepare_blt_clear(sna, tmp); + } if (is_solid(src)) { if (op == PictOpOver && is_opaque_solid(src)) op = PictOpSrc; if (op == PictOpAdd && is_white(src)) op = PictOpSrc; + if (was_clear && (op == PictOpAdd || op == PictOpOver)) + op = PictOpSrc; if (op == PictOpOutReverse && is_opaque_solid(src)) - return prepare_blt_clear(sna, tmp); + goto clear; if (op != PictOpSrc) { DBG(("%s: unsuported op [%d] for blitting\n", diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index d2f16f23..933f5809 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -3033,13 +3033,6 @@ choose_span(PicturePtr dst, } static bool -sna_drawable_is_clear(DrawablePtr d) -{ - struct sna_pixmap *priv = sna_pixmap(get_drawable_pixmap(d)); - return priv && priv->clear && priv->clear_color == 0; -} - -static bool mono_trapezoids_span_converter(CARD8 op, PicturePtr src, PicturePtr dst, INT16 src_x, INT16 src_y, int ntrap, xTrapezoid *traps) |