sna: Sync CPU bo before writes
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 29 Jun 2014 06:00:58 +0000 (07:00 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Sun, 29 Jun 2014 06:13:48 +0000 (07:13 +0100)
Fixes regression from

commit 961139f5878572ebea268a0bbf47caf05af9093f [2.99.912]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri May 30 09:45:15 2014 +0100

    sna: Use manual detiling for downloads

Reported-by: Harald Judt <h.judt@gmx.at>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80560
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_accel.c

index 7a9610c..efcde3e 100644 (file)
@@ -1679,14 +1679,22 @@ static inline bool gpu_bo_download(struct sna *sna,
        if (!kgem_bo_can_map__cpu(&sna->kgem, priv->gpu_bo, FORCE_FULL_SYNC))
                return false;
 
-       if (idle && __kgem_bo_is_busy(&sna->kgem, priv->gpu_bo))
-               return false;
+       if (idle) {
+               if (__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo))
+                       return false;
+
+               if (priv->cpu_bo && __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo))
+                       return false;
+       }
 
        src = kgem_bo_map__cpu(&sna->kgem, priv->gpu_bo);
        if (src == NULL)
                return false;
 
        kgem_bo_sync__cpu_full(&sna->kgem, priv->gpu_bo, FORCE_FULL_SYNC);
+
+       if (priv->cpu_bo)
+               kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
        assert(has_coherent_ptr(sna, priv, MOVE_WRITE));
 
        if (sigtrap_get())