summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-23 11:40:13 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-23 11:40:13 +0000
commitc67e6a05ff729c0ddb26775e1c8533be1144d85a (patch)
treeb07f82970df8d0015be9904c9750b4917cdd96e2
parent9267da93969d1727cb95956c3f63643f0039c60d (diff)
sna: Align the origin of downsampling subregion to an even pixel
In order for us to produce stable downsampled images across multiple frames, we need to sample the same pairs of pixels every time. This requires us to align the origin of the sample region to an even pixel. Reported-by: Clemens Eisserer <linuxhippy@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=45086 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 5f79e04c..4f861379 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -643,6 +643,12 @@ static int sna_render_picture_downsample(struct sna *sna,
oy = v.vector[1] / v.vector[2];
}
+ /* Align the origin to an even pixel so that the sampling of
+ * partial images is stable.
+ */
+ box.x1 &= ~1;
+ box.y1 &= ~1;
+
if (channel->repeat == RepeatNone || channel->repeat == RepeatPad) {
if (box.x1 < 0)
box.x1 = 0;