diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-10 13:06:06 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-10 15:19:36 +0000 |
commit | 934ea64f7ff080b00d00c50ba94f63247d7bb130 (patch) | |
tree | 5c18200efa5cf29c0b2d02eebcbf7af7249c92db /src/sna | |
parent | 8a8edfe4076ee08558c76eddbb68426e4563888c (diff) |
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>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/sna_accel.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index c8268150..359d3bed 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -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, |