summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-19 00:35:14 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-19 00:37:43 +0000
commit7326d3098662688b8040c6e1261064caed1f5d06 (patch)
tree606b7211e057eab830ba71515a7c103cdcf03302
parentae32aaf4b20dafef138dc9c28dbddbfe49f24b83 (diff)
sna: Restore CPU shadow after a GTT memory
When mixing operations and switching between GTT and CPU mappings we need to restore the original CPU shadow rather than accidentally overwrite. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index c44dcc17..69bbc549 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -190,7 +190,10 @@ sna_pixmap_alloc_cpu(struct sna *sna,
struct sna_pixmap *priv,
bool from_gpu)
{
- assert(priv->ptr == NULL);
+ /* Restore after a GTT mapping? */
+ if (priv->ptr)
+ goto done;
+
assert(pixmap->devKind);
if (!DEBUG_NO_LLC && sna->kgem.gen >= 60) {
@@ -219,6 +222,7 @@ sna_pixmap_alloc_cpu(struct sna *sna,
priv->ptr = malloc(pixmap->devKind * pixmap->drawable.height);
assert(priv->ptr);
+done:
pixmap->devPrivate.ptr = priv->ptr;
return priv->ptr != NULL;
}