summaryrefslogtreecommitdiff
path: root/src/sna/sna_blt.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-13 20:08:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-13 20:08:37 +0100
commit2575cd0d236b4e1694e3185a487ebfd8bfe6499f (patch)
tree95ada1e5ec6b0e9add63fc0dcb03b63cc95648c9 /src/sna/sna_blt.c
parent5781de2e5ab0d7e8e62965bda714789879555ed4 (diff)
sna: Avoid corrupting the CPU bo when compositing fallback data through 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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index c2869182..120d9a50 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1866,10 +1866,11 @@ clear:
__FUNCTION__));
} else {
ret = prepare_blt_copy(sna, tmp, bo, alpha_fixup);
- if (fallback)
- ret = prepare_blt_put(sna, tmp, alpha_fixup);
+ if (fallback && !ret)
+ goto put;
}
} else {
+put:
if (!tmp->dst.bo) {
RegionRec region;
@@ -1879,6 +1880,14 @@ clear:
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
MOVE_INPLACE_HINT | MOVE_WRITE))
return false;
+ } else {
+ if (tmp->dst.bo == sna_pixmap(tmp->dst.pixmap)->cpu_bo) {
+ assert(kgem_bo_is_busy(tmp->dst.bo));
+ tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable,
+ FORCE_GPU | PREFER_GPU,
+ &dst_box,
+ &tmp->damage);
+ }
}
ret = prepare_blt_put(sna, tmp, alpha_fixup);
}