sna: Do not apply drawable offsets to DamageRegionAppend
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 24 Oct 2013 14:42:12 +0000 (15:42 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 24 Oct 2013 14:42:12 +0000 (15:42 +0100)
DamageRegionAppend() will itself apply the drawable offsets, so we need
to pass it the untransformed region. This also fixes an issue where we
might fallback without applying any Damage.

Reported-by: Christian Nassau <nassau@nullhomotopie.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32734
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_composite.c

index 200a207..3174639 100644 (file)
@@ -906,9 +906,16 @@ sna_composite_rectangles(CARD8              op,
             (long)RegionNumRects(&region)));
 
        pixmap = get_drawable_pixmap(dst->pDrawable);
-       if (get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y)) {
+
+       /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
+        * manually append the damaged regions ourselves.
+        *
+        * Note that DamageRegionAppend() will apply the drawable-deltas itself.
+        */
+       DamageRegionAppend(&pixmap->drawable, &region);
+
+       if (get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y))
                pixman_region_translate(&region, dst_x, dst_y);
-       }
 
        DBG(("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n",
             __FUNCTION__, dst_x, dst_y,
@@ -934,11 +941,6 @@ sna_composite_rectangles(CARD8              op,
                goto fallback;
        }
 
-       /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
-        * manually append the damaged regions ourselves.
-        */
-       DamageRegionAppend(&pixmap->drawable, &region);
-
        /* If we going to be overwriting any CPU damage with a subsequent
         * operation, then we may as well delete it without moving it
         * first to the GPU.