summaryrefslogtreecommitdiff
path: root/src/sna/sna.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-17 12:01:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-17 12:09:52 +0100
commit621eaba0d5c524878a8803ad285cb9b4b33654a7 (patch)
treee6d69e3ba2aacc07aaad75794e06d641c3a1b193 /src/sna/sna.h
parentefe5c737ed20f2a0b14b479b14eccaf1963d5e01 (diff)
sna: Assert mapped state
When mapped, assert that we point to the expected mapping of the GPU bo. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna.h')
-rw-r--r--src/sna/sna.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 07789ef6..c7382931 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -494,6 +494,20 @@ PixmapPtr sna_pixmap_create_unattached(ScreenPtr screen,
int width, int height, int depth);
void sna_pixmap_destroy(PixmapPtr pixmap);
+static inline void sna_pixmap_unmap(PixmapPtr pixmap, struct sna_pixmap *priv)
+{
+ if (!priv->mapped)
+ return;
+
+ assert(pixmap->devPrivate.ptr == (priv->cpu ? MAP(priv->gpu_bo->map__cpu) : MAP(priv->gpu_bo->map__gtt)));
+ assert(priv->stride && priv->stride);
+
+ pixmap->devPrivate.ptr = PTR(priv->ptr);
+ pixmap->devKind = priv->stride;
+
+ priv->mapped = false;
+}
+
bool
sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags);