summaryrefslogtreecommitdiff
path: root/src/sna/sna_blt.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-12 23:28:51 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-13 17:45:05 +0000
commitc9668a772f15ab36d643a9b0616b309856146c89 (patch)
tree73ccaab29928f3970c2351c71f065a945135a94c /src/sna/sna_blt.c
parent2ea58256f5ce6e1c0f48d366ff7a1fbf300600de (diff)
sna: Reduce OVER with a clear pixmap to a BLT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_blt.c')
-rw-r--r--src/sna/sna_blt.c12
1 files changed, 10 insertions, 2 deletions
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",