aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-12-19 12:20:10 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-12-19 12:20:10 +0100
commit22fea29cf0f568b95570c57a2d5a1e828c758b0d (patch)
tree30fbb9595f5df18f27d53c21322d3d9991cdbb8d
parent8d6a4a9b7bfabcf949ec80f552bd1f0707bf8c63 (diff)
parent034228d75ba1be6b035bdd387c183f14379abdc4 (diff)
downloadnx-libs-22fea29cf0f568b95570c57a2d5a1e828c758b0d.tar.gz
nx-libs-22fea29cf0f568b95570c57a2d5a1e828c758b0d.tar.bz2
nx-libs-22fea29cf0f568b95570c57a2d5a1e828c758b0d.zip
Merge branch 'uli42-pr/fb_fastpath' into 3.6.x
Attributes GH PR #753: https://github.com/ArcticaProject/nx-libs/pull/753
-rw-r--r--nx-X11/programs/Xserver/fb/fbblt.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/nx-X11/programs/Xserver/fb/fbblt.c b/nx-X11/programs/Xserver/fb/fbblt.c
index e820a85eb..6241af8eb 100644
--- a/nx-X11/programs/Xserver/fb/fbblt.c
+++ b/nx-X11/programs/Xserver/fb/fbblt.c
@@ -67,8 +67,42 @@ fbBlt (FbBits *srcLine,
int n, nmiddle;
Bool destInvarient;
int startbyte, endbyte;
+
FbDeclareMergeRop ();
+ if (alu == GXcopy && pm == FB_ALLONES &&
+ !(srcX & 7) && !(dstX & 7) && !(width & 7))
+ {
+ CARD8 *src_byte = (CARD8 *) srcLine + (srcX >> 3);
+ CARD8 *dst_byte = (CARD8 *) dstLine + (dstX >> 3);
+ FbStride src_byte_stride = srcStride << (FB_SHIFT - 3);
+ FbStride dst_byte_stride = dstStride << (FB_SHIFT - 3);
+ int width_byte = (width >> 3);
+
+ /* Make sure there's no overlap; we can't use memcpy in that
+ * case as it's not well defined, so fall through to the
+ * general code
+ */
+ if (src_byte + width_byte <= dst_byte ||
+ dst_byte + width_byte <= src_byte)
+ {
+ int i;
+
+ if (!upsidedown)
+ for (i = 0; i < height; i++)
+ memcpy(dst_byte + i * dst_byte_stride,
+ src_byte + i * src_byte_stride,
+ width_byte);
+ else
+ for (i = height - 1; i >= 0; i--)
+ memcpy(dst_byte + i * dst_byte_stride,
+ src_byte + i * src_byte_stride,
+ width_byte);
+
+ return;
+ }
+ }
+
#ifdef FB_24BIT
if (bpp == 24 && !FbCheck24Pix (pm))
{
@@ -78,28 +112,6 @@ fbBlt (FbBits *srcLine,
}
#endif
- if (alu == GXcopy && pm == FB_ALLONES && !reverse &&
- !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
- int i;
- CARD8 *src = (CARD8 *) srcLine;
- CARD8 *dst = (CARD8 *) dstLine;
-
- srcStride *= sizeof(FbBits);
- dstStride *= sizeof(FbBits);
- width >>= 3;
- src += (srcX >> 3);
- dst += (dstX >> 3);
-
- if (!upsidedown)
- for (i = 0; i < height; i++)
- memcpy(dst + i * dstStride, src + i * srcStride, width);
- else
- for (i = height - 1; i >= 0; i--)
- memcpy(dst + i * dstStride, src + i * srcStride, width);
-
- return;
- }
-
FbInitializeMergeRop(alu, pm);
destInvarient = FbDestInvarientMergeRop();
if (upsidedown)