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>
This commit is contained in:
parent
c2d06c407e
commit
42529336fd
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue