diff -r 84eaa0636bac Android.mk --- a/Android.mk Thu Oct 18 23:38:27 2018 -0400 +++ b/Android.mk Sat Dec 01 14:44:44 2018 +0100 @@ -59,6 +59,8 @@ cmd-strip := endif +LOCAL_STATIC_LIBRARIES := cpufeatures + include $(BUILD_SHARED_LIBRARY) ########################### @@ -108,3 +110,6 @@ LOCAL_LDLIBS := -llog include $(BUILD_SHARED_LIBRARY) + +$(call import-module,android/cpufeatures) + diff -r 84eaa0636bac include/SDL_blendmode.h --- a/include/SDL_blendmode.h Thu Oct 18 23:38:27 2018 -0400 +++ b/include/SDL_blendmode.h Sat Dec 01 14:44:44 2018 +0100 @@ -90,12 +90,12 @@ /** * \brief Create a custom blend mode, which may or may not be supported by a given renderer * - * \param srcColorFactor - * \param dstColorFactor - * \param colorOperation - * \param srcAlphaFactor - * \param dstAlphaFactor - * \param alphaOperation + * \param srcColorFactor source color factor + * \param dstColorFactor destination color factor + * \param colorOperation color operation + * \param srcAlphaFactor source alpha factor + * \param dstAlphaFactor destination alpha factor + * \param alphaOperation alpha operation * * The result of the blend mode operation will be: * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor diff -r 84eaa0636bac src/cpuinfo/SDL_cpuinfo.c --- a/src/cpuinfo/SDL_cpuinfo.c Thu Oct 18 23:38:27 2018 -0400 +++ b/src/cpuinfo/SDL_cpuinfo.c Sat Dec 01 14:44:44 2018 +0100 @@ -78,6 +78,12 @@ #endif #endif +#if defined(__ANDROID__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) +#if __ARM_ARCH < 8 +#include +#endif +#endif + #define CPU_HAS_RDTSC (1 << 0) #define CPU_HAS_ALTIVEC (1 << 1) #define CPU_HAS_MMX (1 << 2) @@ -320,7 +326,7 @@ return altivec; } -#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) +#if defined(__LINUX__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) static int readProcAuxvForNeon(void) { @@ -359,8 +365,20 @@ return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON; #elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL) return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON); -#elif (defined(__LINUX__) || defined(__ANDROID__)) - return readProcAuxvForNeon(); /* Android offers a static library for this, but it just parses /proc/self/auxv */ +#elif defined(__LINUX__) + return readProcAuxvForNeon(); +#elif defined(__ANDROID__) + /* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */ + { + AndroidCpuFamily cpu_family = android_getCpuFamily(); + if (cpu_family == ANDROID_CPU_FAMILY_ARM) { + uint64_t cpu_features = android_getCpuFeatures(); + if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) { + return 1; + } + } + return 0; + } #elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM) /* All WinRT ARM devices are required to support NEON, but just in case. */ return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;