[Vm-dev] [commit][2923] merge in ARM fast blt code
commits at squeakvm.org
commits at squeakvm.org
Tue May 20 20:02:44 UTC 2014
Revision: 2923
Author: rowledge
Date: 2014-05-20 13:02:43 -0700 (Tue, 20 May 2014)
Log Message:
-----------
merge in ARM fast blt code
Modified Paths:
--------------
branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c
Modified: branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c
===================================================================
--- branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c 2014-05-20 02:14:03 UTC (rev 2922)
+++ branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c 2014-05-20 20:02:43 UTC (rev 2923)
@@ -63,6 +63,15 @@
#undef HAVE_OPENGL_GL_H /* don't include Quartz OpenGL if configured */
#include "SqDisplay.h"
+#if defined(USE_FAST_BLT)
+ /* XXX referring to plugin variables *requires* BitBitPlugin to be included by VMM as an internal plugin */
+# if defined(__arm__)
+# include "../../../Cross/plugins/BitBltPlugin/BitBltArm.h"
+# else
+# error configuration error
+# endif
+#endif
+
#if defined(ioMSecs)
# undef ioMSecs
#endif
@@ -6132,9 +6141,60 @@
}
}
+#if defined(USE_FAST_BLT)
+# if defined(__arm__)
+
+ extern void armSimdConvert_x888_8_LEPacking32_8_wide(unsigned int width, unsigned int height,
+ unsigned int *dst, unsigned int dstStride,
+ unsigned int *src, unsigned int srcStride,
+ unsigned int halftone, unsigned int halftoneInfo,
+ unsigned int *colourMap);
+
+ extern void armSimdConvert_x888_8_LEPacking32_8_narrow(unsigned int width, unsigned int height,
+ unsigned int *dst, unsigned int dstStride,
+ unsigned int *src, unsigned int srcStride,
+ unsigned int halftone, unsigned int halftoneInfo,
+ unsigned int *colourMap);
+
+ static void armSimdCopyImage32To8(int *fromImageData, int *toImageData, int width, int height,
+ int affectedL, int affectedT, int affectedR, int affectedB,
+ unsigned int *downGradingColors)
+ {
+ /* Find image strides in 32-bit words */
+ unsigned int srcStride= width;
+ unsigned int dstStride= (width + 3) >> 2;
+ /* Round affected region out to encompass complete words in both images */
+ affectedL &= ~3;
+ affectedR= (affectedR + 3) &~ 3;
+ width= affectedR - affectedL;
+ height= affectedB - affectedT;
+ /* Find first words */
+ fromImageData += srcStride * affectedT + affectedL;
+ toImageData += dstStride * affectedT + (affectedL >> 2);
+ /* Adjust strides to remove number of words read/written */
+ srcStride -= affectedR - affectedL;
+ dstStride -= (affectedR - affectedL) >> 2;
+ /* Work out which width class this operation is. */
+ if (width > (128 - 32) / 8 && ((-1 ^ (width -(128 - 32) / 8)) & ~(31 / 8)))
+ armSimdConvert_x888_8_LEPacking32_8_wide(width, height, toImageData, dstStride, fromImageData, srcStride, 0, 0, downGradingColors);
+ else
+ armSimdConvert_x888_8_LEPacking32_8_narrow(width, height, toImageData, dstStride, fromImageData, srcStride, 0, 0, downGradingColors);
+ }
+# else
+# error configuration error
+# endif
+#endif
+
void copyImage32To8(int *fromImageData, int *toImageData, int width, int height,
int affectedL, int affectedT, int affectedR, int affectedB)
{
+#if defined(USE_FAST_BLT)
+# if defined(__arm__)
+ armSimdCopyImage32To8(fromImageData, toImageData, width, height, affectedL, affectedT, affectedR, affectedB, stDownGradingColors);
+# else
+# error configuration error
+# endif
+#else
int scanLine32, firstWord32, lastWord32;
int scanLine8, firstWord8;
int line;
@@ -6167,6 +6227,7 @@
firstWord8+= scanLine8;
}
#undef map32To8
+#endif /* !USE_FAST_BLT */
}
void copyImage16To32(int *fromImageData, int *toImageData, int width, int height,
@@ -6291,10 +6352,58 @@
#undef map16To24
}
+#if defined(USE_FAST_BLT)
+# if defined(__arm__)
+ extern void armSimdConvert_x888_0565_LEPacking32_16_wide(unsigned int width, unsigned int height,
+ unsigned int *dst, unsigned int dstStride,
+ unsigned int *src, unsigned int srcStride);
+
+ extern void armSimdConvert_x888_0565_LEPacking32_16_narrow(unsigned int width, unsigned int height,
+ unsigned int *dst, unsigned int dstStride,
+ unsigned int *src, unsigned int srcStride);
+ static void armSimdCopyImage32To16(int *fromImageData, int *toImageData, int width, int height,
+ int affectedL, int affectedT, int affectedR, int affectedB)
+ {
+ /* Find image strides in 32-bit words */
+ unsigned int srcStride= width;
+ unsigned int dstStride= (width + 1) >> 1;
+ /* Round affected region out to encompass complete words in both images */
+ affectedL &= ~1;
+ affectedR += affectedR & 1;
+ width= affectedR - affectedL;
+ height= affectedB - affectedT;
+ /* Find first words */
+ fromImageData += srcStride * affectedT + affectedL;
+ toImageData += dstStride * affectedT + (affectedL >> 1);
+ /* Adjust strides to remove number of words read/written */
+ srcStride -= affectedR - affectedL;
+ dstStride -= (affectedR - affectedL) >> 1;
+ /* Work out which width class this operation is. */
+ if (width > (128 - 32) / 16 && ((-1 ^ (width - (128 - 32) / 16)) & ~(31 / 16)))
+ armSimdConvert_x888_0565_LEPacking32_16_wide(width, height, toImageData, dstStride, fromImageData, srcStride);
+ else
+ armSimdConvert_x888_0565_LEPacking32_16_narrow(width, height, toImageData, dstStride, fromImageData, srcStride);
+ }
+
+# else
+# error configuration error
+# endif
+#endif
+
void copyImage32To16(int *fromImageData, int *toImageData, int width, int height,
int affectedL, int affectedT, int affectedR, int affectedB)
{
+#if defined(USE_FAST_BLT)
+# if defined(__arm__)
+ if (stRNMask == 5 && stRShift == 11 && stGNMask == 6 && stGShift == 5 && stBNMask == 5 && stBShift == 0)
+ armSimdCopyImage32To16(fromImageData, toImageData, width, height, affectedL, affectedT, affectedR, affectedB);
+ else
+# else
+# error configuration error
+# endif
+#endif
+ {
int scanLine32, firstWord32, lastWord32;
int scanLine16, firstWord16;
int line;
@@ -6332,6 +6441,7 @@
firstWord16+= scanLine16;
}
#undef map32To16
+ }
}
void copyImage16To16(int *fromImageData, int *toImageData, int width, int height,
@@ -6378,9 +6488,53 @@
#undef map16To16
}
+
+#if defined(USE_FAST_BLT)
+# if defined(__arm__)
+ extern void armSimdConvert_x888_x888BGR_LEPacking32_32_wide(unsigned int width, unsigned int height,
+ unsigned int *dst, unsigned int dstStride,
+ unsigned int *src, unsigned int srcStride);
+
+ extern void armSimdConvert_x888_x888BGR_LEPacking32_32_narrow(unsigned int width, unsigned int height,
+ unsigned int *dst, unsigned int dstStride,
+ unsigned int *src, unsigned int srcStride);
+
+ static void armSimdCopyImage32To32(int *fromImageData, int *toImageData, int width, int height,
+ int affectedL, int affectedT, int affectedR, int affectedB)
+ {
+ unsigned int stride= width;
+ width= affectedR - affectedL;
+ height= affectedB - affectedT;
+ /* Find first words */
+ fromImageData += stride * affectedT + affectedL;
+ toImageData += stride * affectedT + affectedL;
+ /* Adjust stride to remove number of words read/written */
+ stride -= width;
+ /* Work out which width class this operation is. */
+ if (width > (128 - 32) / 32 && (-1 ^ (width - (128 - 32) / 32)))
+ armSimdConvert_x888_x888BGR_LEPacking32_32_wide(width, height, toImageData, stride, fromImageData, stride);
+ else
+ armSimdConvert_x888_x888BGR_LEPacking32_32_narrow(width, height, toImageData, stride, fromImageData, stride);
+ }
+# else
+# error configuration error
+# endif
+#endif
+
+
void copyImage32To32(int *fromImageData, int *toImageData, int width, int height,
int affectedL, int affectedT, int affectedR, int affectedB)
{
+#if defined(USE_FAST_BLT)
+# if defined(__arm__)
+ if ((armCpuFeatures & ARM_V6) && stRNMask == 8 && stRShift == 0 && stGNMask == 8 && stGShift == 8 && stBNMask == 8 && stBShift == 16)
+ armSimdCopyImage32To32(fromImageData, toImageData, width, height, affectedL, affectedT, affectedR, affectedB);
+ else
+# else
+# error unsupported use of ENABLE_FAST_BLT
+# endif
+#endif
+ {
int scanLine32, firstWord32, lastWord32;
int line;
int rshift, gshift, bshift;
@@ -6414,6 +6568,7 @@
lastWord32+= scanLine32;
}
#undef map32To32
+ }
}
void copyImage32To32Same(int *fromImageData, int *toImageData,
More information about the Vm-dev
mailing list