summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-04-08 17:16:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-04-08 17:21:34 +0100
commit0464e93a088a9e8bc29ad8b36b6e12c3dda32ec6 (patch)
tree42504f23881b3edbab664e34a03efc9bd5f2f155
parent479cb6ba71038fe44f66fb31fad90d0d454fea7a (diff)
sna: Add some assertions for misuse of proxies
References: https://bugs.freedesktop.org/show_bug.cgi?id=48400 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c6
-rw-r--r--src/sna/sna_accel.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index de02e9d6..f23bf0c7 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -332,6 +332,7 @@ Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
assert(bo->refcnt);
assert(!bo->purged);
assert(!kgem_busy(kgem, bo->handle));
+ assert(bo->proxy == NULL);
assert(length <= bytes(bo));
if (gem_write(kgem->fd, bo->handle, 0, length, data))
@@ -3156,6 +3157,7 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo)
bo->handle, bo->presumed_offset, bo->tiling, bo->map, bo->domain));
assert(!bo->purged);
+ assert(bo->proxy == NULL);
assert(bo->exec == NULL);
assert(list_is_empty(&bo->list));
@@ -3385,6 +3387,7 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
void kgem_bo_sync__cpu(struct kgem *kgem, struct kgem_bo *bo)
{
+ assert(bo->proxy == NULL);
kgem_bo_submit(kgem, bo);
if (bo->domain != DOMAIN_CPU) {
@@ -4037,7 +4040,8 @@ void kgem_buffer_read_sync(struct kgem *kgem, struct kgem_bo *_bo)
kgem_bo_map__cpu(kgem, &bo->base);
domain = DOMAIN_NONE;
}
- kgem_bo_retire(kgem, &bo->base);
+ kgem_retire(kgem);
+ assert(bo->base.rq == NULL);
bo->base.domain = domain;
}
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 7425a51c..083cd3c4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1933,6 +1933,7 @@ sna_drawable_use_bo(DrawablePtr drawable,
}
if (priv->gpu_bo && priv->gpu_bo->proxy) {
+ assert(priv->gpu_bo->proxy->rq);
kgem_bo_destroy(to_sna_from_pixmap(pixmap), priv->gpu_bo);
priv->gpu_bo = NULL;
goto use_cpu_bo;
@@ -2725,6 +2726,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
if (priv->gpu_bo && priv->gpu_bo->proxy) {
DBG(("%s: discarding cached upload buffer\n", __FUNCTION__));
+ assert(priv->gpu_bo->proxy->rq);
kgem_bo_destroy(sna, priv->gpu_bo);
priv->gpu_bo = NULL;
}
@@ -3520,6 +3522,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
if (dst_priv->gpu_bo && dst_priv->gpu_bo->proxy) {
DBG(("%s: discarding cached upload\n", __FUNCTION__));
+ assert(dst_priv->gpu_bo->proxy->rq);
kgem_bo_destroy(&sna->kgem, dst_priv->gpu_bo);
dst_priv->gpu_bo = NULL;
}