From 665d012b8e1b9666e535a3081404406f31b8a3ef Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 29 Jun 2014 09:26:10 +0100 Subject: sna: Ensure CPU bo is synchronized before writing Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 4 ++++ 1 file changed, 4 insertions(+) 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); } -- cgit v1.2.3