From 2fe6d4569aaf1d9d5262e84d46b6921e47753f6a Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Wed, 26 Dec 2018 16:27:08 +0000 Subject: [PATCH] Bug 1516062 - Turn on NEON when using gcc or clang on aarch64 r=jrmuizel Since we don't define BUILD_ARM_NEON on aarch64 due to bug 1303952, aarch64 doesn't turn on neon for moz2d. Also, msvc don't have arm_neon.h [*1], so we should turn on neon on aarch64 excepting msvc. *1 https://developercommunity.visualstudio.com/content/problem/201662/arm-neonh-doenst-support-arm64-compiler.html Differential Revision: https://phabricator.services.mozilla.com/D15371 --HG-- extra : moz-landing-system : lando --- gfx/2d/Blur.cpp | 4 ++-- gfx/2d/Blur.h | 2 -- gfx/2d/DrawTarget.cpp | 4 ++-- gfx/2d/Swizzle.cpp | 10 +++++----- gfx/2d/moz.build | 4 +++- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gfx/2d/Blur.cpp b/gfx/2d/Blur.cpp index 790ec45e8b86..50064fcc4c5b 100644 --- a/gfx/2d/Blur.cpp +++ b/gfx/2d/Blur.cpp @@ -16,7 +16,7 @@ #include "DataSurfaceHelpers.h" #include "Tools.h" -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON #include "mozilla/arm.h" #endif @@ -660,7 +660,7 @@ void AlphaBoxBlur::Blur(uint8_t* aData) const { integralImageStride); } else #endif -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON if (mozilla::supports_neon()) { BoxBlur_NEON(aData, horizontalLobes[0][0], horizontalLobes[0][1], verticalLobes[0][0], verticalLobes[0][1], integralImage, diff --git a/gfx/2d/Blur.h b/gfx/2d/Blur.h index efa843cfae7a..61ad55a0fc72 100644 --- a/gfx/2d/Blur.h +++ b/gfx/2d/Blur.h @@ -135,12 +135,10 @@ class GFX2D_API AlphaBoxBlur { int32_t aTopLobe, int32_t aBottomLobe, uint32_t* aIntegralImage, size_t aIntegralImageStride) const; -#ifdef BUILD_ARM_NEON void BoxBlur_NEON(uint8_t* aData, int32_t aLeftLobe, int32_t aRightLobe, int32_t aTopLobe, int32_t aBottomLobe, uint32_t* aIntegralImage, size_t aIntegralImageStride) const; -#endif #ifdef _MIPS_ARCH_LOONGSON3A void BoxBlur_LS3(uint8_t* aData, int32_t aLeftLobe, int32_t aRightLobe, int32_t aTopLobe, int32_t aBottomLobe, diff --git a/gfx/2d/DrawTarget.cpp b/gfx/2d/DrawTarget.cpp index 62cb8ee24e03..626fb6bc0e2b 100644 --- a/gfx/2d/DrawTarget.cpp +++ b/gfx/2d/DrawTarget.cpp @@ -14,7 +14,7 @@ #include "BufferEdgePad.h" #include "BufferUnrotate.h" -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON #include "mozilla/arm.h" #include "LuminanceNEON.h" #endif @@ -63,7 +63,7 @@ static void ComputesRGBLuminanceMask(const uint8_t* aSourceData, int32_t aSourceStride, uint8_t* aDestData, int32_t aDestStride, const IntSize& aSize, float aOpacity) { -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON if (mozilla::supports_neon()) { ComputesRGBLuminanceMask_NEON(aSourceData, aSourceStride, aDestData, aDestStride, aSize, aOpacity); diff --git a/gfx/2d/Swizzle.cpp b/gfx/2d/Swizzle.cpp index fb9d2ea8af5e..5ffe2598052b 100644 --- a/gfx/2d/Swizzle.cpp +++ b/gfx/2d/Swizzle.cpp @@ -14,7 +14,7 @@ #include "mozilla/SSE.h" #endif -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON #include "mozilla/arm.h" #endif @@ -131,7 +131,7 @@ void Swizzle_SSE2(const uint8_t*, int32_t, uint8_t*, int32_t, IntSize); #endif -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON /** * ARM NEON optimizations */ @@ -294,7 +294,7 @@ bool PremultiplyData(const uint8_t* aSrc, int32_t aSrcStride, } #endif -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON if (mozilla::supports_neon()) switch (FORMAT_KEY(aSrcFormat, aDstFormat)) { PREMULTIPLY_NEON(SurfaceFormat::B8G8R8A8, SurfaceFormat::B8G8R8A8) PREMULTIPLY_NEON(SurfaceFormat::B8G8R8A8, SurfaceFormat::B8G8R8X8) @@ -426,7 +426,7 @@ bool UnpremultiplyData(const uint8_t* aSrc, int32_t aSrcStride, } #endif -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON if (mozilla::supports_neon()) switch (FORMAT_KEY(aSrcFormat, aDstFormat)) { UNPREMULTIPLY_NEON(SurfaceFormat::B8G8R8A8, SurfaceFormat::B8G8R8A8) UNPREMULTIPLY_NEON(SurfaceFormat::B8G8R8A8, SurfaceFormat::R8G8B8A8) @@ -710,7 +710,7 @@ bool SwizzleData(const uint8_t* aSrc, int32_t aSrcStride, } #endif -#ifdef BUILD_ARM_NEON +#ifdef USE_NEON if (mozilla::supports_neon()) switch (FORMAT_KEY(aSrcFormat, aDstFormat)) { SWIZZLE_NEON(SurfaceFormat::B8G8R8A8, SurfaceFormat::R8G8B8A8) SWIZZLE_NEON(SurfaceFormat::B8G8R8X8, SurfaceFormat::R8G8B8X8) diff --git a/gfx/2d/moz.build b/gfx/2d/moz.build index 81b693aa4435..3aff8195a318 100644 --- a/gfx/2d/moz.build +++ b/gfx/2d/moz.build @@ -221,12 +221,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': 'QuartzSupport.mm', ] -if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']: +if CONFIG['CC_TYPE'] in ('clang', 'gcc') and (CONFIG['CPU_ARCH'] == 'aarch64' or CONFIG['BUILD_ARM_NEON']): + # MSVC cannot use arm_neon.h. SOURCES += [ 'BlurNEON.cpp', 'LuminanceNEON.cpp', 'SwizzleNEON.cpp', ] + DEFINES['USE_NEON'] = True SOURCES['BlurNEON.cpp'].flags += CONFIG['NEON_FLAGS'] SOURCES['LuminanceNEON.cpp'].flags += CONFIG['NEON_FLAGS'] SOURCES['SwizzleNEON.cpp'].flags += CONFIG['NEON_FLAGS']