diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-10 22:37:31 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-10 23:34:51 +0000 |
commit | c295ad8da91e39c8fffa540901097651df5d24b2 (patch) | |
tree | 10945b27e203638a03ad069b8045fea19afa0995 | |
parent | ece7fc8afeb8eefcf0ad1a054f02e7fac8db6327 (diff) |
sna: Transfer the whole bo for a replacement XCopyArea
If we are copying over the entire source onto the destination,just copy
across the GPU bo. This is often used for caching images as pixmaps.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 09e8a0c5..bb52770b 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2015,6 +2015,31 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, src_priv ? src_priv->cpu_bo : NULL, replaces)); + if (replaces) { + if (dst_priv && src_priv && src_priv->gpu_damage == NULL) { + if (sna_pixmap_move_to_gpu(src_pixmap)) { + DBG(("%s: transferring src GPU bo to dst\n", __FUNCTION__)); + if (dst_priv->gpu_bo) + kgem_bo_destroy(&sna->kgem, dst_priv->gpu_bo); + sna_damage_destroy(&dst_priv->cpu_damage); + sna_damage_all(&dst_priv->gpu_damage, + dst_pixmap->drawable.width, + dst_pixmap->drawable.height); + + dst_priv->gpu_bo = src_priv->gpu_bo; + src_priv->gpu_bo = NULL; + + sna_damage_all(&src_priv->cpu_damage, + src_pixmap->drawable.width, + src_pixmap->drawable.height); + return; + } + } + + if (!src_priv || src_priv->gpu_bo == NULL || src_priv->cpu_damage) + goto fallback; + } + /* Try to maintain the data on the GPU */ if (dst_priv && dst_priv->gpu_bo == NULL && src_priv && src_priv->gpu_bo != NULL) { |