diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-31 00:58:51 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-31 00:58:51 +0000 |
commit | 42529336fd92d39a5a5eceb07f2838d4be50fa8e (patch) | |
tree | f512a57b19fd5e84ff292aa7237c563c1a4f75db /src | |
parent | c2d06c407e1c2cbbf3f7f6c4989710a799cd43d0 (diff) |
sna: Prevent falling back to swrast if source is on the GPU
Currently if the dst is wholly contained within the CPU, then we try to
continue to operate on the GPU. However, if we have FORCE_GPU set, it
means that one of the sources for the operation resides on the GPU, and
that would require a readback in order to perform the operation on the
CPU. Hence, if we try to use a CPU bo and fail, convert back to using
the GPU bo if forced.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_accel.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index d34a4f92..e4065060 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2815,11 +2815,23 @@ use_gpu_bo: return priv->gpu_bo; use_cpu_bo: - if (!USE_CPU_BO) - return NULL; + if (!USE_CPU_BO || priv->cpu_bo == NULL) { +cpu_fail: + if ((flags & FORCE_GPU) && priv->gpu_bo) { + get_drawable_deltas(drawable, pixmap, &dx, &dy); + + region.extents = *box; + region.extents.x1 += dx; + region.extents.x2 += dx; + region.extents.y1 += dy; + region.extents.y2 += dy; + region.data = NULL; + + goto move_to_gpu; + } - if (priv->cpu_bo == NULL) return NULL; + } assert(priv->cpu_bo->refcnt); @@ -2858,12 +2870,12 @@ use_cpu_bo: } if (!sna->kgem.can_blt_cpu) - return NULL; + goto cpu_fail; if (!sna_drawable_move_region_to_cpu(&pixmap->drawable, ®ion, (flags & IGNORE_CPU ? MOVE_READ : 0) | MOVE_WRITE | MOVE_ASYNC_HINT)) { DBG(("%s: failed to move-to-cpu, fallback\n", __FUNCTION__)); - return NULL; + goto cpu_fail; } if (priv->shm) { |