summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-08-08 12:11:50 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-08-08 12:18:48 +0100
commit85192f00e345830541e3715e211b1f98154bbef4 (patch)
tree9d5083d20cab126200327add59fdc6f31e8c21b5
parentedc1427f3dcddb73acdb5b5e03756ecb30cb3797 (diff)
sna: Ignore trailing bits when comparing lines inside the bitmap
References: https://bugs.freedesktop.org/show_bug.cgi?id=51422 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/fb/fbbitmap.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sna/fb/fbbitmap.c b/src/sna/fb/fbbitmap.c
index 07587280..fb6c3236 100644
--- a/src/sna/fb/fbbitmap.c
+++ b/src/sna/fb/fbbitmap.c
@@ -58,6 +58,7 @@ RegionPtr
fbBitmapToRegion(PixmapPtr pixmap)
{
const register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1);
+ FbBits maskw;
register RegionPtr region;
const FbBits *bits, *line, *end;
int width, y1, y2, base, x1;
@@ -74,6 +75,9 @@ fbBitmapToRegion(PixmapPtr pixmap)
stride = pixmap->devKind >> (FB_SHIFT - 3);
width = pixmap->drawable.width;
+ maskw = 0;
+ if (width & 7)
+ maskw = FB_ALLONES & ~FbScrRight(FB_ALLONES, width & FB_MASK);
region->extents.x1 = width;
region->extents.x2 = 0;
y2 = 0;
@@ -82,7 +86,10 @@ fbBitmapToRegion(PixmapPtr pixmap)
bits = line;
line += stride;
while (y2 < pixmap->drawable.height &&
- memcmp(bits, line, (width+7)>>3) == 0)
+ memcmp(bits, line, width >> 3) == 0 &&
+ (maskw == 0 ||
+ (bits[width >> (FB_SHIFT - 3)] & maskw) ==
+ (line[width >> (FB_SHIFT - 3)] & maskw)))
line += stride, y2++;
if (READ(bits) & mask0)