summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-29 09:26:10 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-29 15:21:51 +0100
commit665d012b8e1b9666e535a3081404406f31b8a3ef (patch)
treef434c1991efc5ca4f37416f8ab748c6c2647ba69
parent6b906ae742ec96eeef403191d3cdded6a23a70b7 (diff)
sna: Ensure CPU bo is synchronized before writing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 54fece48..fe10bf2f 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1528,6 +1528,7 @@ static inline bool has_coherent_ptr(struct sna *sna, struct sna_pixmap *priv, un
if (!priv->cpu_bo)
return true;
+ assert(!priv->cpu_bo->needs_flush);
assert(priv->pixmap->devKind == priv->cpu_bo->pitch);
return priv->pixmap->devPrivate.ptr == MAP(priv->cpu_bo->map__cpu);
}
@@ -1790,6 +1791,9 @@ static void download_boxes(struct sna *sna,
if (!ok)
ok = gpu_bo_download(sna, priv, n, box, false);
if (!ok) {
+ if (priv->cpu_bo)
+ kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
+ assert(priv->mapped == MAPPED_NONE);
assert(has_coherent_ptr(sna, priv, MOVE_WRITE));
sna_read_boxes(sna, priv->pixmap, priv->gpu_bo, box, n);
}