From d635e05c9dd26a397ccf958be091b56d1075e923 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 28 Jun 2013 19:24:06 +0100 Subject: 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 --- src/sna/sna_accel.c | 17 ++++++++++------- 1 file 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, -- cgit v1.2.3