summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-04 23:52:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-05 00:05:33 +0100
commit19e170aa6fd3652cc2e983a291f82350dca27e52 (patch)
treef86226671300c63024a0e0237521376feaeba6f5
parent7895416eabfc5bd361d0d0ff92c570e2f6af47e0 (diff)
sna: Fix comparison of memcpy overlap to include x-offsets
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/fb/fbblt.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/sna/fb/fbblt.c b/src/sna/fb/fbblt.c
index 3b3fa485..62ed2a14 100644
--- a/src/sna/fb/fbblt.c
+++ b/src/sna/fb/fbblt.c
@@ -287,19 +287,18 @@ fbBlt(FbBits *srcLine, FbStride srcStride, int srcX,
DBG(("%s fast blt, src_stride=%d, dst_stride=%d, width=%d (offset=%d)\n",
__FUNCTION__,
- srcStride, dstStride, width,
- srcLine - dstLine));
+ srcStride, dstStride, width, s - d));
- if ((srcLine < dstLine && srcLine + width > dstLine) ||
- (dstLine < srcLine && dstLine + width > srcLine))
+ if (width == srcStride && width == dstStride) {
+ width *= height;
+ height = 1;
+ }
+
+ if ((s < d && s + width > d) || (d < s && d + width > s))
func = memmove;
else
func = memcpy;
if (!upsidedown) {
- if (srcStride == dstStride && srcStride == width) {
- width *= height;
- height = 1;
- }
for (i = 0; i < height; i++)
func(d + i * dstStride,
s + i * srcStride,