Bug 1428182 - 9. Apply Skia upstream commit to support NDK r16; r=lsalzman
Apply Skia upstream commit 592c225b03ca677a1217eabdbc38eede6afcdb14 to
support building with NDK r16.
MozReview-Commit-ID: B6popOoPTni
--- a/gfx/skia/skia/src/core/SkCpu.cpp
+++ b/gfx/skia/skia/src/core/SkCpu.cpp
@@ -80,18 +80,20 @@
static uint32_t read_cpu_features() {
uint32_t features = 0;
uint32_t hwcaps = getauxval(AT_HWCAP);
if (hwcaps & HWCAP_CRC32) { features |= SkCpu::CRC32; }
return features;
}
-#elif defined(SK_CPU_ARM32) && __has_include(<asm/hwcap.h>) && __has_include(<sys/auxv.h>)
- // asm/hwcap.h and sys/auxv.h won't be present on NDK builds before API v21.
+#elif defined(SK_CPU_ARM32) && __has_include(<sys/auxv.h>) && \
+ (!defined(__ANDROID_API__) || __ANDROID_API__ >= 18)
+ // sys/auxv.h will always be present in the Android NDK due to unified
+ //headers, but getauxval is only defined for API >= 18.
#include <asm/hwcap.h>
#include <sys/auxv.h>
static uint32_t read_cpu_features() {
uint32_t features = 0;
uint32_t hwcaps = getauxval(AT_HWCAP);
if (hwcaps & HWCAP_VFPv4) { features |= SkCpu::NEON|SkCpu::NEON_FMA|SkCpu::VFP_FP16; }
return features;