sna: Allow the CPU bo to be created if GPU rendering is forced
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 23 Jun 2014 08:47:34 +0000 (09:47 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 23 Jun 2014 09:01:19 +0000 (10:01 +0100)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_accel.c

index e4520d1..f362a9c 100644 (file)
@@ -3765,21 +3765,27 @@ use_gpu_bo:
 
 use_cpu_bo:
        if (!USE_CPU_BO || priv->cpu_bo == NULL) {
+               if ((flags & FORCE_GPU) == 0)
+                       return NULL;
+
+               if (!sna_drawable_move_region_to_cpu(&pixmap->drawable, &region,
+                                                    (flags & IGNORE_DAMAGE ? 0 : MOVE_READ) | MOVE_WRITE | MOVE_ASYNC_HINT)) {
 cpu_fail:
-               if ((flags & FORCE_GPU) && priv->gpu_bo) {
-                       region.extents = *box;
-                       if (get_drawable_deltas(drawable, pixmap, &dx, &dy)) {
-                               region.extents.x1 += dx;
-                               region.extents.x2 += dx;
-                               region.extents.y1 += dy;
-                               region.extents.y2 += dy;
+                       if (priv->gpu_bo) {
+                               region.extents = *box;
+                               if (get_drawable_deltas(drawable, pixmap, &dx, &dy)) {
+                                       region.extents.x1 += dx;
+                                       region.extents.x2 += dx;
+                                       region.extents.y1 += dy;
+                                       region.extents.y2 += dy;
+                               }
+                               region.data = NULL;
+
+                               goto move_to_gpu;
                        }
-                       region.data = NULL;
 
-                       goto move_to_gpu;
+                       return NULL;
                }
-
-               return NULL;
        }
 
        assert(priv->cpu_bo->refcnt);