[Vm-dev] [commit][2749] Update the BitBltPlugin to include the fast
Arm ASM option.
commits at squeakvm.org
commits at squeakvm.org
Mon Jul 15 22:18:31 UTC 2013
Revision: 2749
Author: eliot
Date: 2013-07-15 15:18:31 -0700 (Mon, 15 Jul 2013)
Log Message:
-----------
Update the BitBltPlugin to include the fast Arm ASM option.
Modified Paths:
--------------
branches/Cog/nscogbuild/cygwinbuild/Makefile
branches/Cog/src/examplePlugins.ext
branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c
branches/Cog/src/vm/exampleSqNamedPrims.h
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogbuild/cygwinbuild/Makefile
===================================================================
--- branches/Cog/nscogbuild/cygwinbuild/Makefile 2013-07-15 21:59:10 UTC (rev 2748)
+++ branches/Cog/nscogbuild/cygwinbuild/Makefile 2013-07-15 22:18:31 UTC (rev 2749)
@@ -190,6 +190,8 @@
# Do make init to allow make -n to function.
init: $(OBJDIR) eitheror.exe mkNamedPrims.exe
+cleanall: clean cleanast cleandbg
+
clean:
rm -rf sqNamedPrims.h eitheror.exe mkNamedPrims.exe build
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
- Fri Jul 12 16:29:31 PDT 2013
+ Mon Jul 15 15:14:38 PDT 2013
Modified: branches/Cog/src/examplePlugins.ext
===================================================================
--- branches/Cog/src/examplePlugins.ext 2013-07-15 21:59:10 UTC (rev 2748)
+++ branches/Cog/src/examplePlugins.ext 2013-07-15 22:18:31 UTC (rev 2749)
@@ -46,5 +46,6 @@
UUIDPlugin \
AioPlugin \
UnixOSProcessPlugin \
+VMProfileLinuxSupportPlugin \
VMProfileMacSupportPlugin \
Win32OSProcessPlugin
Modified: branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c
===================================================================
--- branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c 2013-07-15 21:59:10 UTC (rev 2748)
+++ branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c 2013-07-15 22:18:31 UTC (rev 2749)
@@ -1,9 +1,9 @@
/* Automatically generated by
- SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9
+ SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
from
- BitBltSimulation VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9
+ BitBltSimulation VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4
*/
-static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9 " __DATE__ ;
+static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ;
@@ -33,6 +33,12 @@
#define EXPORT(returnType) static returnType
#endif
+#ifdef ENABLE_FAST_BLT
+#include "BitBltDispatch.h"
+#else
+// to handle the unavoidable decl in the spec of copyBitsFallback();
+#define operation_t void
+#endif
#include "sqMemoryAccess.h"
@@ -102,8 +108,11 @@
static sqInt clearWordwith(sqInt source, sqInt destination);
static void clipRange(void);
EXPORT(void) copyBits(void);
+static void copyBitsFastPathSpecialised(void);
EXPORT(void) copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue);
static void copyBitsLockedAndClipped(void);
+static void copyBitsRule41Test(void);
+void copyBitsFallback(operation_t *op, unsigned int flags);
static void copyLoop(void);
static void copyLoopNoSource(void);
static void copyLoopPixMap(void);
@@ -337,9 +346,9 @@
};
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "BitBltPlugin VMMaker.oscog-eem.282 (i)"
+ "BitBltPlugin VMMaker.oscog-eem.302 (i)"
#else
- "BitBltPlugin VMMaker.oscog-eem.282 (e)"
+ "BitBltPlugin VMMaker.oscog-eem.302 (e)"
#endif
;
static sqInt noHalftone;
@@ -1203,18 +1212,6 @@
EXPORT(void)
copyBits(void)
{
- sqInt done;
- sqInt dWid;
- sqInt dxLowBits;
- sqInt endBits;
- sqInt gammaLookupTableOop;
- sqInt pixPerM1;
- sqInt pixPerM11;
- sqInt startBits;
- sqInt sxLowBits;
- sqInt t;
- sqInt ungammaLookupTableOop;
-
clipRange();
if ((bbW <= 0)
|| (bbH <= 0)) {
@@ -1227,68 +1224,160 @@
if (!(lockSurfaces())) {
primitiveFail(); return;
}
- /* begin copyBitsLockedAndClipped */
- if (combinationRule == 41) {
+
+# if ENABLE_FAST_BLT
- /* fetch the forecolor into componentAlphaModeColor. */
+ /* you really, really mustn't call this unless you have the rest of the code to link to */
- componentAlphaModeAlpha = 255;
- componentAlphaModeColor = 16777215;
- gammaLookupTable = null;
- ungammaLookupTable = null;
- if ((methodArgumentCount()) >= 2) {
- componentAlphaModeAlpha = stackIntegerValue((methodArgumentCount()) - 2);
- if (!(!(failed()))) {
- primitiveFail();
- goto l1;
+ copyBitsFastPathSpecialised();
+
+# else /* ENABLE_FAST_BLT */
+ copyBitsLockedAndClipped();
+
+# endif /* ENABLE_FAST_BLT */
+
+ unlockSurfaces();
+}
+
+
+/* Perform the actual copyBits operation using the fast path specialised
+ code; fail some cases by falling back to normal code.
+ Assume: Surfaces have been locked and clipping was performed.
+ */
+
+static void
+copyBitsFastPathSpecialised(void)
+{
+
+# if ENABLE_FAST_BLT
+
+ /* set the affected area to 0 first */
+
+ affectedL = (affectedR = (affectedT = (affectedB = 0)));
+ copyBitsRule41Test();
+ if (!(!(failed()))) {
+ primitiveFail(); return;
+ }
+ if ((combinationRule == 30) || (combinationRule == 31)) {
+
+ /* Check and fetch source alpha parameter for alpha blend */
+
+ if ((methodArgumentCount()) == 1) {
+ sourceAlpha = stackIntegerValue(0);
+ if (!((!(failed()))
+ && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) {
+ primitiveFail(); return;
}
- componentAlphaModeColor = stackIntegerValue((methodArgumentCount()) - 1);
- if (!(!(failed()))) {
- primitiveFail();
- goto l1;
- }
- if ((methodArgumentCount()) == 4) {
- gammaLookupTableOop = stackObjectValue(1);
- if (isBytes(gammaLookupTableOop)) {
- gammaLookupTable = firstIndexableField(gammaLookupTableOop);
- }
- ungammaLookupTableOop = stackObjectValue(0);
- if (isBytes(ungammaLookupTableOop)) {
- ungammaLookupTable = firstIndexableField(ungammaLookupTableOop);
- }
- }
}
else {
- if ((methodArgumentCount()) == 1) {
- componentAlphaModeColor = stackIntegerValue(0);
- if (!(!(failed()))) {
- primitiveFail();
- goto l1;
- }
- }
- else {
- primitiveFail();
- goto l1;
- }
+ primitiveFail(); return;
}
}
+ if ((combinationRule != 22) && (combinationRule != 32)) {
+
+ /* zero width and height; return the count */
+
+ affectedL = dx;
+ affectedR = dx + bbW;
+ affectedT = dy;
+ affectedB = dy + bbH;
+ }
+
+ // fill the operation structure
+ operation_t op;
+ op.combinationRule = combinationRule;
+ op.noSource = noSource;
+ op.src.bits = (void *) sourceBits;
+ op.src.pitch = sourcePitch;
+ op.src.depth = sourceDepth;
+ op.src.msb = sourceMSB;
+ op.src.x = sx;
+ op.src.y = sy;
+ op.dest.bits = (void *) destBits;
+ op.dest.pitch = destPitch;
+ op.dest.depth = destDepth;
+ op.dest.msb = destMSB;
+ op.dest.x = dx;
+ op.dest.y = dy;
+ op.width = bbW;
+ op.height = bbH;
+ op.cmFlags = cmFlags;
+ op.cmShiftTable = (void *) cmShiftTable;
+ op.cmMaskTable = (void *) cmMaskTable;
+ op.cmMask = cmMask;
+ op.cmLookupTable = (void *) cmLookupTable;
+ op.noHalftone = noHalftone;
+ op.halftoneHeight = halftoneHeight;
+ op.halftoneBase = (void *) halftoneBase;
+ if (combinationRule == 30 || combinationRule == 31) {
+ op.opt.sourceAlpha = sourceAlpha;
+ }
+ if (combinationRule == 41) {
+ op.opt.componentAlpha.componentAlphaModeColor = componentAlphaModeColor;
+ op.opt.componentAlpha.componentAlphaModeAlpha = componentAlphaModeAlpha;
+ op.opt.componentAlpha.gammaLookupTable = (void *) gammaLookupTable;
+ op.opt.componentAlpha.ungammaLookupTable = (void *) ungammaLookupTable;
+ }
+ // call the sneaky code
+ copyBitsDispatch(&op);
+
+# endif /* ENABLE_FAST_BLT */
+
+}
+
+
+/* Support for the balloon engine. */
+
+EXPORT(void)
+copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue)
+{
+ destX = startX;
+ destY = yValue;
+ sourceX = startX;
+ width = stopX - startX;
+ copyBits();
+ /* begin showDisplayBits */
+ showDisplayBitsLeftTopRightBottom(destForm, affectedL, affectedT, affectedR, affectedB);
+}
+
+
+/* Perform the actual copyBits operation.
+ Assume: Surfaces have been locked and clipping was performed. */
+
+static void
+copyBitsLockedAndClipped(void)
+{
+ sqInt done;
+ sqInt dWid;
+ sqInt dxLowBits;
+ sqInt endBits;
+ sqInt pixPerM1;
+ sqInt pixPerM11;
+ sqInt startBits;
+ sqInt sxLowBits;
+ sqInt t;
+
+ copyBitsRule41Test();
+ if (!(!(failed()))) {
+ primitiveFail(); return;
+ }
/* begin tryCopyingBitsQuickly */
if (noSource) {
done = 0;
- goto l2;
+ goto l1;
}
if (!((combinationRule == 34)
|| (combinationRule == 41))) {
done = 0;
- goto l2;
+ goto l1;
}
if (!(sourceDepth == 32)) {
done = 0;
- goto l2;
+ goto l1;
}
if (sourceForm == destForm) {
done = 0;
- goto l2;
+ goto l1;
}
if (combinationRule == 41) {
if (destDepth == 32) {
@@ -1298,7 +1387,7 @@
affectedT = dy;
affectedB = dy + bbH;
done = 1;
- goto l2;
+ goto l1;
}
if (destDepth == 16) {
rgbComponentAlpha16();
@@ -1307,7 +1396,7 @@
affectedT = dy;
affectedB = dy + bbH;
done = 1;
- goto l2;
+ goto l1;
}
if (destDepth == 8) {
rgbComponentAlpha8();
@@ -1316,19 +1405,19 @@
affectedT = dy;
affectedB = dy + bbH;
done = 1;
- goto l2;
+ goto l1;
}
done = 0;
- goto l2;
+ goto l1;
}
if (destDepth < 8) {
done = 0;
- goto l2;
+ goto l1;
}
if ((destDepth == 8)
&& ((cmFlags & ColorMapPresent) == 0)) {
done = 0;
- goto l2;
+ goto l1;
}
if (destDepth == 32) {
alphaSourceBlendBits32();
@@ -1344,10 +1433,9 @@
affectedT = dy;
affectedB = dy + bbH;
done = 1;
-l2: /* end tryCopyingBitsQuickly */;
+l1: /* end tryCopyingBitsQuickly */;
if (done) {
- null;
- goto l1;
+ return;
}
if ((combinationRule == 30) || (combinationRule == 31)) {
@@ -1357,13 +1445,11 @@
sourceAlpha = stackIntegerValue(0);
if (!((!(failed()))
&& ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) {
- primitiveFail();
- goto l1;
+ primitiveFail(); return;
}
}
else {
- primitiveFail();
- goto l1;
+ primitiveFail(); return;
}
}
@@ -1537,47 +1623,19 @@
affectedT = (dy - bbH) + 1;
affectedB = dy + 1;
}
-l1: /* end copyBitsLockedAndClipped */;
- unlockSurfaces();
}
-/* Support for the balloon engine. */
+/* Test possible use of rule 41, rgbComponentAlpha:with: Nothing to return,
+ just set up some variables
+ */
-EXPORT(void)
-copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue)
-{
- destX = startX;
- destY = yValue;
- sourceX = startX;
- width = stopX - startX;
- copyBits();
- /* begin showDisplayBits */
- showDisplayBitsLeftTopRightBottom(destForm, affectedL, affectedT, affectedR, affectedB);
-}
-
-
-/* Perform the actual copyBits operation.
- Assume: Surfaces have been locked and clipping was performed. */
-
static void
-copyBitsLockedAndClipped(void)
+copyBitsRule41Test(void)
{
- sqInt done;
- sqInt dWid;
- sqInt dxLowBits;
- sqInt endBits;
sqInt gammaLookupTableOop;
- sqInt pixPerM1;
- sqInt pixPerM11;
- sqInt startBits;
- sqInt sxLowBits;
- sqInt t;
sqInt ungammaLookupTableOop;
-
- /* Try a shortcut for stuff that should be run as quickly as possible */
-
if (combinationRule == 41) {
/* fetch the forecolor into componentAlphaModeColor. */
@@ -1618,6 +1676,74 @@
}
}
}
+}
+
+
+/* Recover from the fast path specialised code saying Help-I-cant-cope */
+
+void
+copyBitsFallback(operation_t *op, unsigned int flags)
+{
+ sqInt done;
+ sqInt dWid;
+ sqInt dxLowBits;
+ sqInt endBits;
+ sqInt pixPerM1;
+ sqInt pixPerM11;
+ sqInt startBits;
+ sqInt sxLowBits;
+ sqInt t;
+
+
+# if ENABLE_FAST_BLT
+
+ /* recover values from the operation struct used by the fast ARM code */
+
+
+ combinationRule = op->combinationRule;
+ noSource = op->noSource;
+ sourceBits = (sqInt) op->src.bits;
+ sourcePitch = op->src.pitch;
+ sourceDepth = op->src.depth;
+ sourceMSB = op->src.msb;
+ sx = op->src.x;
+ sy = op->src.y;
+ destBits = (sqInt) op->dest.bits;
+ destPitch = op->dest.pitch;
+ destDepth = op->dest.depth;
+ destMSB = op->dest.msb;
+ dx = op->dest.x;
+ dy = op->dest.y;
+ bbW = op->width;
+ bbH = op->height;
+ cmFlags = op->cmFlags;
+ cmShiftTable = (void *) op->cmShiftTable;
+ cmMaskTable = (void *) op->cmMaskTable;
+ cmMask = op->cmMask;
+ cmLookupTable = (void *) op->cmLookupTable;
+ noHalftone = op->noHalftone;
+ halftoneHeight = op->halftoneHeight;
+ halftoneBase = (sqInt) op->halftoneBase;
+ if (combinationRule == 30 || combinationRule == 31) {
+ sourceAlpha = op->opt.sourceAlpha;
+ }
+ if (combinationRule == 41) {
+ componentAlphaModeColor = op->opt.componentAlpha.componentAlphaModeColor;
+ componentAlphaModeAlpha = op->opt.componentAlpha.componentAlphaModeAlpha;
+ gammaLookupTable = (void *) op->opt.componentAlpha.gammaLookupTable;
+ ungammaLookupTable = (void *) op->opt.componentAlpha.ungammaLookupTable;
+ }
+ destPPW = 32 / destDepth;
+ cmBitsPerColor = 0;
+ if (cmMask == 511) {
+ cmBitsPerColor = 3;
+ }
+ if (cmMask == 4095) {
+ cmBitsPerColor = 4;
+ }
+ if (cmMask == 16383) {
+ cmBitsPerColor = 5;
+ }
/* begin tryCopyingBitsQuickly */
if (noSource) {
done = 0;
@@ -1694,22 +1820,7 @@
if (done) {
return;
}
- if ((combinationRule == 30) || (combinationRule == 31)) {
- /* Check and fetch source alpha parameter for alpha blend */
-
- if ((methodArgumentCount()) == 1) {
- sourceAlpha = stackIntegerValue(0);
- if (!((!(failed()))
- && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) {
- primitiveFail(); return;
- }
- }
- else {
- primitiveFail(); return;
- }
- }
-
/* Choose and perform the actual copy loop. */
bitCount = 0;
@@ -1858,28 +1969,9 @@
copyLoop();
}
}
- if ((combinationRule == 22) || (combinationRule == 32)) {
- /* zero width and height; return the count */
+# endif /* ENABLE_FAST_BLT */
- affectedL = (affectedR = (affectedT = (affectedB = 0)));
- }
- if (hDir > 0) {
- affectedL = dx;
- affectedR = dx + bbW;
- }
- else {
- affectedL = (dx - bbW) + 1;
- affectedR = dx + 1;
- }
- if (vDir > 0) {
- affectedT = dy;
- affectedB = dy + bbH;
- }
- else {
- affectedT = (dy - bbH) + 1;
- affectedB = dy + 1;
- }
}
Modified: branches/Cog/src/vm/exampleSqNamedPrims.h
===================================================================
--- branches/Cog/src/vm/exampleSqNamedPrims.h 2013-07-15 21:59:10 UTC (rev 2748)
+++ branches/Cog/src/vm/exampleSqNamedPrims.h 2013-07-15 22:18:31 UTC (rev 2749)
@@ -1,5 +1,5 @@
/* This is an automatically generated table of all builtin modules in the VM
- CoInterpreterMT VMMaker.oscog-eem.248
+ CoInterpreterPrimitives VMMaker.oscog-eem.302
*/
extern sqExport vm_exports[];
More information about the Vm-dev
mailing list