summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-11 18:07:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-11 18:54:54 +0100
commite3a0e40310b6c46b2f887bc0d75b11cc06ec8fa0 (patch)
tree44b2705e4f69e12ebfe0c2ca80c594958bb23e43
parent55660376d555131348e7efaaec66d6d27ffc1e6e (diff)
sna: Fix direction flags for memmove
Under a compositor, the current deltas may invert the sense of the copy direction, causing scrolling corruption. Simplify handling those flags by making them invariant for the function. Reported-by: Bruno Prémont <bonbons@linux-vserver.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79843 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index db8091ef..58f3fd7a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5407,7 +5407,7 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
BoxPtr box = region_rects(region);
int n = region_num_rects(region);
int alu = gc ? gc->alu : GXcopy;
- int16_t tx, ty;
+ int16_t tx, ty, sx, sy;
assert(pixmap == get_drawable_pixmap(dst));
@@ -5428,10 +5428,10 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
dx, dy, alu,
pixmap->drawable.width, pixmap->drawable.height));
- if (get_drawable_deltas(src, pixmap, &tx, &ty))
- dx += tx, dy += ty;
- if (dst != src)
- get_drawable_deltas(dst, pixmap, &tx, &ty);
+ get_drawable_deltas(dst, pixmap, &tx, &ty);
+ get_drawable_deltas(src, pixmap, &sx, &sy);
+ sx += dx;
+ sy += dy;
if (priv == NULL || DAMAGE_IS_ALL(priv->cpu_damage)) {
DBG(("%s: unattached, or all damaged on CPU\n", __FUNCTION__));
@@ -5453,7 +5453,7 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
assert(priv->cpu_damage == NULL);
if (!sna->render.copy_boxes(sna, alu,
- pixmap, priv->gpu_bo, dx, dy,
+ pixmap, priv->gpu_bo, sx, sy,
pixmap, priv->gpu_bo, tx, ty,
box, n, 0)) {
DBG(("%s: fallback - accelerated copy boxes failed\n",
@@ -5490,7 +5490,7 @@ fallback:
ty * stride + tx * bpp / 8);
src_bits = (FbBits *)
((char *)pixmap->devPrivate.ptr +
- dy * stride + dx * bpp / 8);
+ sy * stride + sx * bpp / 8);
for (i = 0; i < n; i++)
memmove_box(src_bits, dst_bits,
@@ -5503,9 +5503,8 @@ fallback:
goto out;
if (sigtrap_get() == 0) {
- get_drawable_deltas(src, pixmap, &tx, &ty);
miCopyRegion(src, dst, gc,
- region, dx - tx, dy - ty,
+ region, dx, dy,
fbCopyNtoN, 0, NULL);
sigtrap_put();
}