summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-22 08:56:49 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-22 08:58:30 +0100
commit92dbedc6138b923aa473935013ecb0346280c4d3 (patch)
tree0833d3ee36878eba102a8345578ef1872643182b
parent3e1be265cf950976b5929b14a9dad0664deaa2c1 (diff)
sna: Force the stall before trying to upload into a busy CPU bo
Under the circumstances where we can not instead stream the write into the GPU bo, we need to use the busy CPU bo. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54978 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_blt.c29
-rw-r--r--src/sna/sna_composite.c6
2 files changed, 24 insertions, 11 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index b97df22e..6685549a 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1614,6 +1614,7 @@ prepare_blt_put(struct sna *sna,
assert(src->devPrivate.ptr);
if (op->dst.bo) {
+ assert(op->dst.bo == sna_pixmap(op->dst.pixmap)->gpu_bo);
if (alpha_fixup) {
op->u.blt.pixel = alpha_fixup;
op->blt = blt_put_composite_with_alpha;
@@ -1870,25 +1871,33 @@ clear:
goto put;
}
} else {
+ struct sna_pixmap *priv;
+
put:
- if (!tmp->dst.bo) {
+ priv = sna_pixmap(tmp->dst.pixmap);
+ if (tmp->dst.bo == priv->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);
+ if (tmp->dst.bo == priv->cpu_bo) {
+ DBG(("%s: forcing the stall to overwrite a busy CPU bo\n", __FUNCTION__));
+ tmp->dst.bo = NULL;
+ }
+ }
+
+ if (tmp->dst.bo == NULL) {
RegionRec region;
region.extents = dst_box;
region.data = NULL;
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
- MOVE_INPLACE_HINT | MOVE_WRITE))
+ MOVE_INPLACE_HINT | MOVE_READ | 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);
}
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index d3df17d9..60d39cde 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -527,7 +527,7 @@ sna_composite(CARD8 op,
get_drawable_dx(dst->pDrawable),
get_drawable_dy(dst->pDrawable)));
- if (op <= PictOpSrc) {
+ if (op <= PictOpSrc && priv->cpu_damage) {
int16_t x, y;
get_drawable_deltas(dst->pDrawable, pixmap, &x, &y);
@@ -535,6 +535,10 @@ sna_composite(CARD8 op,
pixman_region_translate(&region, x, y);
sna_damage_subtract(&priv->cpu_damage, &region);
+ if (priv->cpu_damage == NULL) {
+ list_del(&priv->list);
+ priv->cpu = false;
+ }
if (x|y)
pixman_region_translate(&region, -x, -y);