summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-07-18 13:26:36 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-07-19 14:04:38 +0100
commit4723a730f4dc2d007577f43fe232c49b305c2695 (patch)
tree9e039c0cf3800c26a470201d25463610485a8ff4 /src
parentb2f32373815e166fc6dceb477139ff2ef27db0ba (diff)
sna: Discard overwritten operations before doing a BLT composite
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_blt.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index b071683f..beef9a65 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -2031,8 +2031,12 @@ clear:
hint = 0;
if (can_render(sna)) {
hint |= PREFER_GPU;
- if (dst->pCompositeClip->data == NULL && (width | height))
+ if (dst->pCompositeClip->data == NULL && (width | height)) {
hint |= IGNORE_CPU;
+ if (width == tmp->dst.pixmap->drawable.width &&
+ height == tmp->dst.pixmap->drawable.height)
+ hint |= REPLACES;
+ }
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
@@ -2051,7 +2055,9 @@ clear:
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
MOVE_INPLACE_HINT | MOVE_WRITE))
return false;
- }
+ } else if (hint & REPLACES)
+ kgem_bo_undo(&sna->kgem, tmp->dst.bo);
+
return prepare_blt_clear(sna, tmp);
}
@@ -2081,6 +2087,9 @@ fill:
hint |= PREFER_GPU;
if (dst->pCompositeClip->data == NULL && (width | height))
hint |= IGNORE_CPU;
+ if (width == tmp->dst.pixmap->drawable.width &&
+ height == tmp->dst.pixmap->drawable.height)
+ hint |= REPLACES;
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
@@ -2099,7 +2108,8 @@ fill:
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
MOVE_INPLACE_HINT | MOVE_WRITE))
return false;
- }
+ } else if (hint & REPLACES)
+ kgem_bo_undo(&sna->kgem, tmp->dst.bo);
return prepare_blt_fill(sna, tmp, color);
}
@@ -2228,14 +2238,21 @@ fill:
hint = 0;
if (bo || can_render(sna)) {
hint |= PREFER_GPU;
- if (dst->pCompositeClip->data == NULL && (width | height))
+ if (dst->pCompositeClip->data == NULL && (width | height)) {
hint |= IGNORE_CPU;
+ if (width == tmp->dst.pixmap->drawable.width &&
+ height == tmp->dst.pixmap->drawable.height)
+ hint |= REPLACES;
+ }
if (bo)
hint |= FORCE_GPU;
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
+ if (hint & REPLACES)
+ kgem_bo_undo(&sna->kgem, tmp->dst.bo);
+
ret = false;
if (bo) {
if (!tmp->dst.bo) {