summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-10-02 11:44:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-10-02 11:44:16 +0100
commit0ae6c2ccb006a99e8d7bbfff77f98cc58f62ce2f (patch)
treebfffda9b8417a59d2ba37d97feb36697a3bcece6
parent52b211cb15b3bfe33a61cafcd8dcc1c9fbf20243 (diff)
sna: Actually upload the damage when replacing a busy CPU bo for PutImage
Reported-by: Roman Jarosz <kedgedev@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55508 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 3523fba9..b5e6730f 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2240,6 +2240,7 @@ out:
if ((flags & MOVE_ASYNC_HINT) == 0 && priv->cpu_bo) {
DBG(("%s: syncing cpu bo\n", __FUNCTION__));
kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
+ assert(!kgem_bo_is_busy(priv->cpu_bo));
}
priv->cpu = (flags & MOVE_ASYNC_HINT) == 0;
assert(pixmap->devPrivate.ptr);
@@ -3447,6 +3448,12 @@ static bool upload_inplace(struct sna *sna,
}
}
+ if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo) &&
+ !(priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo))) {
+ DBG(("%s: yes, CPU bo is busy, but the GPU bo is not\n", __FUNCTION__));
+ return true;
+ }
+
if (!region_inplace(sna, pixmap, region, priv, true)) {
DBG(("%s? no, region not suitable\n", __FUNCTION__));
return false;
@@ -3572,6 +3579,12 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
priv->gpu_bo = NULL;
}
+ if (priv->mapped) {
+ assert(!priv->shm);
+ pixmap->devPrivate.ptr = NULL;
+ priv->mapped = false;
+ }
+
/* If the GPU is currently accessing the CPU pixmap, then
* we will need to wait for that to finish before we can
* modify the memory.
@@ -3586,25 +3599,19 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
if (priv->cpu_damage) {
if (!region_subsumes_drawable(region, &pixmap->drawable)) {
sna_damage_subtract(&priv->cpu_damage, region);
- if (!sna_pixmap_move_to_gpu(pixmap,
- MOVE_WRITE))
+ if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT))
return false;
} else {
sna_damage_destroy(&priv->cpu_damage);
priv->undamaged = false;
}
- assert(priv->cpu_damage == NULL);
}
+ assert(priv->cpu_damage == NULL);
sna_damage_all(&priv->gpu_damage,
pixmap->drawable.width,
pixmap->drawable.height);
sna_pixmap_free_cpu(sna, priv);
- }
-
- if (priv->mapped) {
- assert(!priv->shm);
- pixmap->devPrivate.ptr = NULL;
- priv->mapped = false;
+ assert(pixmap->devPrivate.ptr == NULL);
}
if (pixmap->devPrivate.ptr == NULL &&
@@ -3649,6 +3656,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
pixmap->drawable.height);
sna_pixmap_free_gpu(sna, priv);
priv->undamaged = false;
+ assert(priv->gpu_damage == NULL);
} else {
sna_damage_subtract(&priv->gpu_damage, region);
sna_damage_add(&priv->cpu_damage, region);