summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-20 19:34:18 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-20 19:34:38 +0100
commitb3d1118bbee1172f72c946163a37ca4ad5feecce (patch)
tree71576759eba29c1799ed7b029d105df0f1c8baf9
parent186ac909ad2099f834e7b2c513a02cd4d041327c (diff)
sna: Promote the CopyArea to the GPU if it subsumes the CPU damage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9cbecfe2..a481388a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4312,10 +4312,11 @@ out:
static bool
move_to_gpu(PixmapPtr pixmap, struct sna_pixmap *priv,
- const BoxRec *box, uint8_t alu)
+ const RegionRec *region, int16_t dx, int16_t dy,
+ uint8_t alu)
{
- int w = box->x2 - box->x1;
- int h = box->y2 - box->y1;
+ int w = region->extents.x2 - region->extents.x1;
+ int h = region->extents.y2 - region->extents.y1;
int count;
if (DAMAGE_IS_ALL(priv->gpu_damage)) {
@@ -4336,6 +4337,12 @@ move_to_gpu(PixmapPtr pixmap, struct sna_pixmap *priv,
if (priv->gpu_bo->tiling)
return true;
+
+ RegionTranslate(region, dx, dy);
+ count = region_subsumes_damage(region, priv->cpu_damage);
+ RegionTranslate(region, -dx, -dy);
+ if (count)
+ return true;
} else {
if ((priv->create & KGEM_CAN_CREATE_GPU) == 0)
return false;
@@ -4759,7 +4766,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
}
if (src_priv &&
- move_to_gpu(src_pixmap, src_priv, &region->extents, alu) &&
+ move_to_gpu(src_pixmap, src_priv, region, src_dx, src_dy, alu) &&
sna_pixmap_move_to_gpu(src_pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
DBG(("%s: move whole src_pixmap to GPU and copy\n",
__FUNCTION__));