summaryrefslogtreecommitdiff
path: root/src/sna/sna.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-01-16 11:20:30 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-01-16 12:18:28 +0000
commit6db99169a99393a8a669f89682bb8df13a7c5677 (patch)
tree3ef4bbff1598f97af9519cd44064f03b199ec503 /src/sna/sna.h
parent242d7503ddd98c59feda4bcc25e70cac06d3325e (diff)
sna: Regularly check that the devPrivate.ptr is valid
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna.h')
-rw-r--r--src/sna/sna.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 0acc9a22..3ac0fad5 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -503,13 +503,17 @@ PixmapPtr sna_pixmap_create_unattached(ScreenPtr screen,
int width, int height, int depth);
void sna_pixmap_destroy(PixmapPtr pixmap);
-#define assert_pixmap_map(pixmap, priv) \
- assert(priv->mapped == false || pixmap->devPrivate.ptr == (priv->mapped == MAPPED_CPU ? MAP(priv->gpu_bo->map__cpu) : MAP(priv->gpu_bo->map__gtt)));
+#define assert_pixmap_map(pixmap, priv) do { \
+ assert(priv->mapped != MAPPED_NONE || pixmap->devPrivate.ptr == PTR(priv->ptr)); \
+ assert(priv->mapped == MAPPED_NONE || pixmap->devPrivate.ptr == (priv->mapped == MAPPED_CPU ? MAP(priv->gpu_bo->map__cpu) : MAP(priv->gpu_bo->map__gtt))); \
+} while (0)
static inline void sna_pixmap_unmap(PixmapPtr pixmap, struct sna_pixmap *priv)
{
- if (priv->mapped == MAPPED_NONE)
+ if (priv->mapped == MAPPED_NONE) {
+ assert(pixmap->devPrivate.ptr == PTR(priv->ptr));
return;
+ }
DBG(("%s: pixmap=%ld dropping %s mapping\n",
__FUNCTION__, pixmap->drawable.serialNumber,