sna: With a GPU bo and a shm source, do not fall all the way back
The normal source upload into GPU bo knows a few more tricks that we may want to apply first before copying into the shadow of the GPU bo. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
8a8edfe407
commit
934ea64f7f
|
|
@ -4375,6 +4375,26 @@ source_prefer_gpu(struct sna_pixmap *priv)
|
|||
return priv->gpu_bo != NULL;
|
||||
}
|
||||
|
||||
static bool use_shm_bo(struct sna *sna,
|
||||
struct kgem_bo *bo,
|
||||
struct sna_pixmap *priv,
|
||||
int alu)
|
||||
{
|
||||
if (priv == NULL || priv->cpu_bo == NULL)
|
||||
return false;
|
||||
|
||||
if (!priv->shm)
|
||||
return true;
|
||||
|
||||
if (alu != GXcopy)
|
||||
return true;
|
||||
|
||||
if (kgem_bo_is_busy(bo))
|
||||
return true;
|
||||
|
||||
return __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo);
|
||||
}
|
||||
|
||||
static void
|
||||
sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
||||
RegionPtr region, int dx, int dy,
|
||||
|
|
@ -4556,7 +4576,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
|||
if (bo != dst_priv->gpu_bo)
|
||||
goto fallback;
|
||||
|
||||
if (src_priv && src_priv->cpu_bo) {
|
||||
if (use_shm_bo(sna, bo, src_priv, alu)) {
|
||||
bool ret;
|
||||
|
||||
DBG(("%s: region overlaps CPU damage, copy from CPU bo\n",
|
||||
|
|
@ -4564,13 +4584,6 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
|||
|
||||
assert(bo != dst_priv->cpu_bo);
|
||||
|
||||
if (src_priv->shm &&
|
||||
alu == GXcopy &&
|
||||
DAMAGE_IS_ALL(src_priv->cpu_damage) &&
|
||||
!__kgem_bo_is_busy(&sna->kgem, src_priv->cpu_bo) &&
|
||||
(replaces || !__kgem_bo_is_busy(&sna->kgem, bo)))
|
||||
goto fallback;
|
||||
|
||||
RegionTranslate(region, src_dx, src_dy);
|
||||
ret = sna_drawable_move_region_to_cpu(&src_pixmap->drawable,
|
||||
region,
|
||||
|
|
|
|||
Loading…
Reference in New Issue