summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-28 19:24:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-29 16:08:30 +0100
commitd635e05c9dd26a397ccf958be091b56d1075e923 (patch)
treee978da7756cb215726ff88f60479a222f97299b2
parent2d40500851a7c6d857b17258e4989ddf7401cfbc (diff)
sna: Promote assert(!priv->mapped) along migration paths
With the advent of the more permissive mapping schemes and finer damage tracking, we are more liable to have pixmaps mapped and so can reach the upload path with the pixmap still mapped. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index eb588c7c..18836c86 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1578,7 +1578,6 @@ sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags)
flags));
assert(priv->gpu_bo == cow->bo);
- assert(!priv->mapped);
assert(cow->refcnt);
list_del(&priv->cow_list);
@@ -1670,6 +1669,10 @@ sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags)
assert(priv->gpu_bo);
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
priv->gpu_bo = bo;
+ if (priv->gpu_bo == NULL && priv->mapped) {
+ priv->pixmap->devPrivate.ptr = NULL;
+ priv->mapped = false;
+ }
}
priv->cow = NULL;
@@ -2953,11 +2956,11 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
box, n, 0);
}
if (!ok) {
- assert(!priv->mapped);
- if (pixmap->devPrivate.ptr == NULL) {
+ if (priv->mapped || pixmap->devPrivate.ptr == NULL) {
assert(priv->ptr && priv->stride);
pixmap->devPrivate.ptr = PTR(priv->ptr);
pixmap->devKind = priv->stride;
+ priv->mapped = false;
}
if (n == 1 && !priv->pinned &&
box->x1 <= 0 && box->y1 <= 0 &&
@@ -2992,11 +2995,11 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
box, 1, 0);
}
if (!ok) {
- assert(!priv->mapped);
- if (pixmap->devPrivate.ptr == NULL) {
+ if (priv->mapped || pixmap->devPrivate.ptr == NULL) {
assert(priv->ptr && priv->stride);
pixmap->devPrivate.ptr = PTR(priv->ptr);
pixmap->devKind = priv->stride;
+ priv->mapped = false;
}
ok = sna_write_boxes(sna, pixmap,
priv->gpu_bo, 0, 0,
@@ -3023,11 +3026,11 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
box, n, 0);
}
if (!ok) {
- assert(!priv->mapped);
- if (pixmap->devPrivate.ptr == NULL) {
+ if (priv->mapped || pixmap->devPrivate.ptr == NULL) {
assert(priv->ptr && priv->stride);
pixmap->devPrivate.ptr = PTR(priv->ptr);
pixmap->devKind = priv->stride;
+ priv->mapped = false;
}
ok = sna_write_boxes(sna, pixmap,
priv->gpu_bo, 0, 0,