Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(614)

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 4323046: Add NEON runtime detection for ARM platforms Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 13 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Makefile ('k') | src/core/SkBitmapProcState_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState.cpp
===================================================================
--- src/core/SkBitmapProcState.cpp (revision 1010)
+++ src/core/SkBitmapProcState.cpp (working copy)
@@ -77,7 +77,7 @@
// SRC == 8888
-#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_opaque(x, y, a, b, c, d, dst)
+#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_opaque_portable(x, y, a, b, c, d, dst)
#define MAKENAME(suffix) S32_opaque_D32 ## suffix
#define DSTSIZE 32
@@ -89,7 +89,7 @@
#include "SkBitmapProcState_sample.h"
#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_alpha(x, y, a, b, c, d, dst, alphaScale)
+#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_alpha_portable(x, y, a, b, c, d, dst, alphaScale)
#define MAKENAME(suffix) S32_alpha_D32 ## suffix
#define DSTSIZE 32
@@ -139,7 +139,7 @@
// SRC == Index8
#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_opaque(x, y, a, b, c, d, dst)
+#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_opaque_portable(x, y, a, b, c, d, dst)
#define MAKENAME(suffix) SI8_opaque_D32 ## suffix
#define DSTSIZE 32
@@ -153,7 +153,7 @@
#include "SkBitmapProcState_sample.h"
#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_alpha(x, y, a, b, c, d, dst, alphaScale)
+#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_alpha_portable(x, y, a, b, c, d, dst, alphaScale)
#define MAKENAME(suffix) SI8_alpha_D32 ## suffix
#define DSTSIZE 32
@@ -229,7 +229,7 @@
#define FILTER_PROC(x, y, a, b, c, d, dst) \
do { \
SkPMColor dstColor; \
- Filter_32_opaque(x, y, a, b, c, d, &dstColor); \
+ Filter_32_opaque_portable(x, y, a, b, c, d, &dstColor); \
(*dst) = SkPixel32ToPixel16(dstColor); \
} while (0)
@@ -323,7 +323,7 @@
#define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF)
#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_opaque(x, y, a, b, c, d, dst)
+#define FILTER_PROC(x, y, a, b, c, d, dst) Filter_32_opaque_portable(x, y, a, b, c, d, dst)
#define MAKENAME(suffix) Clamp_SI8_opaque_D32 ## suffix
#define SRCTYPE uint8_t
#define DSTTYPE uint32_t
@@ -341,6 +341,12 @@
return (dimension & ~0x3FFF) == 0;
}
+#ifdef __ARM_ARCH__
+extern bool hasNeonRegisters();
+extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState& s, int x, int y,
+ uint32_t* SK_RESTRICT colors, int count);
+#endif
+
bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
if (fOrigBitmap.width() == 0 || fOrigBitmap.height() == 0) {
return false;
@@ -510,9 +516,85 @@
NULL, NULL, NULL, NULL
};
- fSampleProc32 = gSample32[index];
+#ifdef __ARCH_ARM__
+ static const SampleProc32 gSample32_neon[] = {
+ S32_opaque_D32_nofilter_DXDY_neon,
+ S32_alpha_D32_nofilter_DXDY_neon,
+ S32_opaque_D32_nofilter_DX_neon,
+ S32_alpha_D32_nofilter_DX_neon,
+ S32_opaque_D32_filter_DXDY_neon,
+ S32_alpha_D32_filter_DXDY_neon,
+ S32_opaque_D32_filter_DX_neon,
+ S32_alpha_D32_filter_DX_neon,
+
+ S16_opaque_D32_nofilter_DXDY,
+ S16_alpha_D32_nofilter_DXDY,
+ S16_opaque_D32_nofilter_DX,
+ S16_alpha_D32_nofilter_DX,
+ S16_opaque_D32_filter_DXDY,
+ S16_alpha_D32_filter_DXDY,
+ S16_opaque_D32_filter_DX,
+ S16_alpha_D32_filter_DX,
+
+ SI8_opaque_D32_nofilter_DXDY_neon,
+ SI8_alpha_D32_nofilter_DXDY_neon,
+ SI8_opaque_D32_nofilter_DX_neon,
+ SI8_alpha_D32_nofilter_DX_neon,
+ SI8_opaque_D32_filter_DXDY_neon,
+ SI8_alpha_D32_filter_DXDY_neon,
+ SI8_opaque_D32_filter_DX_neon,
+ SI8_alpha_D32_filter_DX_neon,
+
+ S4444_opaque_D32_nofilter_DXDY,
+ S4444_alpha_D32_nofilter_DXDY,
+ S4444_opaque_D32_nofilter_DX,
+ S4444_alpha_D32_nofilter_DX,
+ S4444_opaque_D32_filter_DXDY,
+ S4444_alpha_D32_filter_DXDY,
+ S4444_opaque_D32_filter_DX,
+ S4444_alpha_D32_filter_DX,
+
+ // A8 treats alpha/opauqe the same (equally efficient)
+ SA8_alpha_D32_nofilter_DXDY,
+ SA8_alpha_D32_nofilter_DXDY,
+ SA8_alpha_D32_nofilter_DX,
+ SA8_alpha_D32_nofilter_DX,
+ SA8_alpha_D32_filter_DXDY,
+ SA8_alpha_D32_filter_DXDY,
+ SA8_alpha_D32_filter_DX,
+ SA8_alpha_D32_filter_DX
+ };
+
+ static const SampleProc16 gSample16_neon[] = {
+ S32_D16_nofilter_DXDY_neon,
+ S32_D16_nofilter_DX_neon,
+ S32_D16_filter_DXDY_neon,
+ S32_D16_filter_DX_neon,
+
+ S16_D16_nofilter_DXDY,
+ S16_D16_nofilter_DX,
+ S16_D16_filter_DXDY,
+ S16_D16_filter_DX,
+
+ SI8_D16_nofilter_DXDY,
+ SI8_D16_nofilter_DX,
+ SI8_D16_filter_DXDY,
+ SI8_D16_filter_DX,
+
+ // Don't support 4444 -> 565
+ NULL, NULL, NULL, NULL,
+ // Don't support A8 -> 565
+ NULL, NULL, NULL, NULL
+ };
+
+ fSampleProc32 = hasNeonRegisters() ? gSample32_neon[index] : gSample32[index];
index >>= 1; // shift away any opaque/alpha distinction
- fSampleProc16 = gSample16[index];
+ fSampleProc16 = hasNeonRegisters() ? gSample16_neon[index] : gSample16[index];
+#else
+ fSampleProc32 = gSample32[index];
+ index >>= 1; // shift away any opaque/alpha distinction
+ fSampleProc16 = gSample16[index];
+#endif
// our special-case shaderprocs
if (S16_D16_filter_DX == fSampleProc16) {
@@ -523,7 +605,11 @@
fShaderProc16 = Repeat_S16_D16_filter_DX_shaderproc;
}
} else if (SI8_opaque_D32_filter_DX == fSampleProc32 && clamp_clamp) {
+#ifdef __ARM_ARCH__
+ fShaderProc32 = hasNeonRegisters() ? Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon : Clamp_SI8_opaque_D32_filter_DX_shaderproc;
+#else
fShaderProc32 = Clamp_SI8_opaque_D32_filter_DX_shaderproc;
+#endif
}
// see if our platform has any accelerated overrides
« no previous file with comments | « Makefile ('k') | src/core/SkBitmapProcState_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b