diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-17 18:38:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-17 18:45:28 +0100 |
commit | 40ff29480a0dbf458adf1a1b0d3275ad1361530e (patch) | |
tree | ef08677895fba85f94b60db9ba2dbd7bc976d1cc /src/sna/fb | |
parent | fce69c79c4840e7863d7c382da0d22be90a9f19a (diff) |
sna: Tweak fast blt path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/fb')
-rw-r--r-- | src/sna/fb/fbblt.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/sna/fb/fbblt.c b/src/sna/fb/fbblt.c index 247a331c..fd55c85a 100644 --- a/src/sna/fb/fbblt.c +++ b/src/sna/fb/fbblt.c @@ -276,6 +276,7 @@ fbBlt(FbBits *srcLine, FbStride srcStride, int srcX, if (alu == GXcopy && pm == FB_ALLONES && ((srcX|dstX|width) & 7) == 0) { CARD8 *s = (CARD8 *) srcLine; CARD8 *d = (CARD8 *) dstLine; + void *(*func)(void *, const void *, size_t); int i; srcStride *= sizeof(FbBits); @@ -287,28 +288,24 @@ fbBlt(FbBits *srcLine, FbStride srcStride, int srcX, DBG(("%s fast blt\n", __FUNCTION__)); if ((srcLine < dstLine && srcLine + width > dstLine) || - (dstLine < srcLine && dstLine + width > srcLine)) { - if (!upsidedown) - for (i = 0; i < height; i++) - memmove(d + i * dstStride, - s + i * srcStride, - width); - else - for (i = height - 1; i >= 0; i--) - memmove(d + i * dstStride, - s + i * srcStride, - width); + (dstLine < srcLine && dstLine + width > srcLine)) + 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, + width); } else { - if (!upsidedown) - for (i = 0; i < height; i++) - memcpy(d + i * dstStride, - s + i * srcStride, - width); - else - for (i = height - 1; i >= 0; i--) - memcpy(d + i * dstStride, - s + i * srcStride, - width); + for (i = height; i--; ) + func(d + i * dstStride, + s + i * srcStride, + width); } return; |