diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 4 | ||||
-rw-r--r-- | src/core/SkBitmapProcState_matrixProcs.cpp | 6 | ||||
-rw-r--r-- | src/core/SkBlitter_RGB16.cpp | 8 | ||||
-rw-r--r-- | src/core/SkOpts.cpp | 6 | ||||
-rw-r--r-- | src/core/SkUtilsArm.h | 71 | ||||
-rw-r--r-- | src/opts/SkOpts_neon.cpp | 54 |
6 files changed, 13 insertions, 136 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index fc749116df..33dd8f5194 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -19,7 +19,7 @@ #include "SkImageEncoder.h" #include "SkResourceCache.h" -#if !SK_ARM_NEON_IS_NONE +#if defined(SK_ARM_HAS_NEON) // These are defined in src/opts/SkBitmapProcState_arm_neon.cpp extern const SkBitmapProcState::SampleProc32 gSkBitmapProcStateSample32_neon[]; extern void S16_D16_filter_DX_neon(const SkBitmapProcState&, const uint32_t*, int, uint16_t*); @@ -296,7 +296,7 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp) return false; } -#if !SK_ARM_NEON_IS_ALWAYS +#if !defined(SK_ARM_HAS_NEON) static const SampleProc32 gSkBitmapProcStateSample32[] = { S32_opaque_D32_nofilter_DXDY, S32_alpha_D32_nofilter_DXDY, diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp index 16f1bc6f28..1b747de280 100644 --- a/src/core/SkBitmapProcState_matrixProcs.cpp +++ b/src/core/SkBitmapProcState_matrixProcs.cpp @@ -47,16 +47,16 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count); /////////////////////////////////////////////////////////////////////////////// // Compile neon code paths if needed -#if !SK_ARM_NEON_IS_NONE +#if defined(SK_ARM_HAS_NEON) // These are defined in src/opts/SkBitmapProcState_matrixProcs_neon.cpp extern const SkBitmapProcState::MatrixProc ClampX_ClampY_Procs_neon[]; extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; -#endif // !SK_ARM_NEON_IS_NONE +#endif // defined(SK_ARM_HAS_NEON) // Compile non-neon code path if needed -#if !SK_ARM_NEON_IS_ALWAYS +#if !defined(SK_ARM_HAS_NEON) #define MAKENAME(suffix) ClampX_ClampY ## suffix #define TILEX_PROCF(fx, max) SkClampMax((fx) >> 16, max) #define TILEY_PROCF(fy, max) SkClampMax((fy) >> 16, max) diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp index 38edd60a9d..066ec616de 100644 --- a/src/core/SkBlitter_RGB16.cpp +++ b/src/core/SkBlitter_RGB16.cpp @@ -20,7 +20,7 @@ extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device, uint32_t expanded32, unsigned maskRB); #endif -#if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) +#if defined(SK_ARM_HAS_NEON) && defined(SK_CPU_LENDIAN) #include <arm_neon.h> extern void SkRGB16BlitterBlitV_neon(uint16_t* device, int height, @@ -381,7 +381,7 @@ void SkRGB16_Opaque_Blitter::blitMask(const SkMask& mask, unsigned maskRB = mask.fRowBytes - width; uint32_t expanded32 = fExpandedRaw16; -#if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) +#if defined(SK_ARM_HAS_NEON) && defined(SK_CPU_LENDIAN) #define UNROLL 8 do { int w = width; @@ -475,7 +475,7 @@ void SkRGB16_Opaque_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { unsigned scale5 = SkAlpha255To256(alpha) >> 3; uint32_t src32 = fExpandedRaw16 * scale5; scale5 = 32 - scale5; -#if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) +#if defined(SK_ARM_HAS_NEON) && defined(SK_CPU_LENDIAN) SkRGB16BlitterBlitV_neon(device, height, deviceRB, scale5, src32); #else do { @@ -654,7 +654,7 @@ void SkRGB16_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { unsigned scale5 = SkAlpha255To256(alpha) * fScale >> (8 + 3); uint32_t src32 = fExpandedRaw16 * scale5; scale5 = 32 - scale5; -#if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) +#if defined(SK_ARM_HAS_NEON) && defined(SK_CPU_LENDIAN) SkRGB16BlitterBlitV_neon(device, height, deviceRB, scale5, src32); #else do { diff --git a/src/core/SkOpts.cpp b/src/core/SkOpts.cpp index 54463b250c..c6ff43b532 100644 --- a/src/core/SkOpts.cpp +++ b/src/core/SkOpts.cpp @@ -82,7 +82,6 @@ namespace SkOpts { void Init_sse42() {} void Init_avx() {} void Init_avx2() {} - void Init_neon(); static void init() { // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug or feature? @@ -92,11 +91,6 @@ namespace SkOpts { if (SkCpu::Supports(SkCpu::SSE42)) { Init_sse42(); } if (SkCpu::Supports(SkCpu::AVX )) { Init_avx(); } if (SkCpu::Supports(SkCpu::AVX2 )) { Init_avx2(); } - - #elif defined(SK_CPU_ARM32) && \ - defined(SK_BUILD_FOR_ANDROID) && \ - !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) - if (SkCpu::Supports(SkCpu::NEON)) { Init_neon(); } #endif } diff --git a/src/core/SkUtilsArm.h b/src/core/SkUtilsArm.h index dde933bafa..0d35193e04 100644 --- a/src/core/SkUtilsArm.h +++ b/src/core/SkUtilsArm.h @@ -8,75 +8,12 @@ #ifndef SkUtilsArm_DEFINED #define SkUtilsArm_DEFINED -#include "SkCpu.h" -#include "SkUtils.h" +#include "SkTypes.h" -// Define SK_ARM_NEON_MODE to one of the following values -// corresponding respectively to: -// - No ARM Neon support at all (not targetting ARMv7-A, or don't have NEON) -// - Full ARM Neon support (i.e. assume the CPU always supports it) -// - Optional ARM Neon support (i.e. probe CPU at runtime) -// -#define SK_ARM_NEON_MODE_NONE 0 -#define SK_ARM_NEON_MODE_ALWAYS 1 -#define SK_ARM_NEON_MODE_DYNAMIC 2 - -#if defined(SK_ARM_HAS_OPTIONAL_NEON) -# define SK_ARM_NEON_MODE SK_ARM_NEON_MODE_DYNAMIC -#elif defined(SK_ARM_HAS_NEON) -# define SK_ARM_NEON_MODE SK_ARM_NEON_MODE_ALWAYS -#else -# define SK_ARM_NEON_MODE SK_ARM_NEON_MODE_NONE -#endif - -// Convenience test macros, always defined as 0 or 1 -#define SK_ARM_NEON_IS_NONE (SK_ARM_NEON_MODE == SK_ARM_NEON_MODE_NONE) -#define SK_ARM_NEON_IS_ALWAYS (SK_ARM_NEON_MODE == SK_ARM_NEON_MODE_ALWAYS) -#define SK_ARM_NEON_IS_DYNAMIC (SK_ARM_NEON_MODE == SK_ARM_NEON_MODE_DYNAMIC) - -// The sk_cpu_arm_has_neon() function returns true iff the target device -// is ARMv7-A and supports Neon instructions. In DYNAMIC mode, this actually -// probes the CPU at runtime (and caches the result). - -static inline bool sk_cpu_arm_has_neon(void) { -#if SK_ARM_NEON_IS_NONE - return false; +#if defined(SK_ARM_HAS_NEON) + #define SK_ARM_NEON_WRAP(x) (x ## _neon) #else - return SkCpu::Supports(SkCpu::NEON); -#endif -} - -// Use SK_ARM_NEON_WRAP(symbol) to map 'symbol' to a NEON-specific symbol -// when applicable. This will transform 'symbol' differently depending on -// the current NEON configuration, i.e.: -// -// NONE -> 'symbol' -// ALWAYS -> 'symbol_neon' -// DYNAMIC -> 'symbol' or 'symbol_neon' depending on runtime check. -// -// The goal is to simplify user code, for example: -// -// return SK_ARM_NEON_WRAP(do_something)(params); -// -// Replaces the equivalent: -// -// #if SK_ARM_NEON_IS_NONE -// return do_something(params); -// #elif SK_ARM_NEON_IS_ALWAYS -// return do_something_neon(params); -// #elif SK_ARM_NEON_IS_DYNAMIC -// if (sk_cpu_arm_has_neon()) -// return do_something_neon(params); -// else -// return do_something(params); -// #endif -// -#if SK_ARM_NEON_IS_NONE -# define SK_ARM_NEON_WRAP(x) (x) -#elif SK_ARM_NEON_IS_ALWAYS -# define SK_ARM_NEON_WRAP(x) (x ## _neon) -#elif SK_ARM_NEON_IS_DYNAMIC -# define SK_ARM_NEON_WRAP(x) (sk_cpu_arm_has_neon() ? x ## _neon : x) + #define SK_ARM_NEON_WRAP(x) (x) #endif #endif // SkUtilsArm_DEFINED diff --git a/src/opts/SkOpts_neon.cpp b/src/opts/SkOpts_neon.cpp deleted file mode 100644 index 751bea2513..0000000000 --- a/src/opts/SkOpts_neon.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkOpts.h" - -#define SK_OPTS_NS sk_neon -#include "SkBlitMask_opts.h" -#include "SkBlitRow_opts.h" -#include "SkBlurImageFilter_opts.h" -#include "SkColorCubeFilter_opts.h" -#include "SkMorphologyImageFilter_opts.h" -#include "SkSwizzler_opts.h" -#include "SkTextureCompressor_opts.h" -#include "SkXfermode_opts.h" - -namespace SkOpts { - void Init_neon() { - create_xfermode = sk_neon::create_xfermode; - - box_blur_xx = sk_neon::box_blur_xx; - box_blur_xy = sk_neon::box_blur_xy; - box_blur_yx = sk_neon::box_blur_yx; - - dilate_x = sk_neon::dilate_x; - dilate_y = sk_neon::dilate_y; - erode_x = sk_neon::erode_x; - erode_y = sk_neon::erode_y; - - texture_compressor = sk_neon::texture_compressor; - fill_block_dimensions = sk_neon::fill_block_dimensions; - - blit_mask_d32_a8 = sk_neon::blit_mask_d32_a8; - - blit_row_color32 = sk_neon::blit_row_color32; - blit_row_s32a_opaque = sk_neon::blit_row_s32a_opaque; - - color_cube_filter_span = sk_neon::color_cube_filter_span; - - RGBA_to_BGRA = sk_neon::RGBA_to_BGRA; - RGBA_to_rgbA = sk_neon::RGBA_to_rgbA; - RGBA_to_bgrA = sk_neon::RGBA_to_bgrA; - RGB_to_RGB1 = sk_neon::RGB_to_RGB1; - RGB_to_BGR1 = sk_neon::RGB_to_BGR1; - gray_to_RGB1 = sk_neon::gray_to_RGB1; - grayA_to_RGBA = sk_neon::grayA_to_RGBA; - grayA_to_rgbA = sk_neon::grayA_to_rgbA; - inverted_CMYK_to_RGB1 = sk_neon::inverted_CMYK_to_RGB1; - inverted_CMYK_to_BGR1 = sk_neon::inverted_CMYK_to_BGR1; - } -} |