summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-02-27 08:33:52 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-02-27 08:33:52 +0000
commit27ac9f574f65cbd535751c925e9b2e2d7c8a6b3a (patch)
treea80d672f6587d48a7635c7a1b1e031a8c45036fa
parentff49944928c7399527b11bb0da7699711591c21a (diff)
sna: Avoid promoting region-to-whole migration and discarding damage
Fixes regression from commit 1de1104064b5898cbed37e836901694a381c1266 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Feb 21 22:43:04 2014 +0000 sna: Use a hint to do whole image uploads inplace Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75549 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index abc3b85d..9ead602a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2495,10 +2495,10 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
flags |= MOVE_INPLACE_HINT;
}
- if (flags & MOVE_WHOLE_HINT)
+ if (flags & MOVE_WHOLE_HINT && priv->gpu_damage == NULL)
return _sna_pixmap_move_to_cpu(pixmap, flags);
- if (priv->gpu_bo == NULL &&
+ if (priv->gpu_damage == NULL &&
(priv->create & KGEM_CAN_CREATE_GPU) == 0 &&
flags & MOVE_WRITE)
return _sna_pixmap_move_to_cpu(pixmap, flags);
@@ -2522,6 +2522,24 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
return _sna_pixmap_move_to_cpu(pixmap, flags);
}
+ if ((flags & MOVE_READ) == 0 &&
+ priv->gpu_damage &&
+ region_subsumes_damage(region, priv->gpu_damage)) {
+ DBG(("%s: region [(%d, %d), (%d, %d)] subsumes damage [(%d,%d), (%d, %d)]\n",
+ __FUNCTION__,
+ region->extents.x1,
+ region->extents.y1,
+ region->extents.x2,
+ region->extents.y2,
+ priv->gpu_damage->extents.x1,
+ priv->gpu_damage->extents.y1,
+ priv->gpu_damage->extents.x2,
+ priv->gpu_damage->extents.y2));
+ if (dx | dy)
+ RegionTranslate(region, -dx, -dy);
+ return _sna_pixmap_move_to_cpu(pixmap, flags);
+ }
+
if (priv->move_to_gpu && !priv->move_to_gpu(sna, priv, MOVE_READ)) {
DBG(("%s: move-to-gpu override failed\n", __FUNCTION__));
if (dx | dy)