Bug 1428182 - 9. Apply Skia upstream commit to support NDK r16; r=lsalzman draft
authorJim Chen <nchen@mozilla.com>
Tue, 30 Jan 2018 14:08:23 -0500
changeset 748996 f34f4d38ccd1cc8f371cf2fcaeb9967a75783649
parent 748995 fbdfd41f323f6438830ceb54b9b98e00f6d6e300
child 748997 808300485cc83caf9b871e3c9338229c4172d500
push id97287
push userbmo:nchen@mozilla.com
push dateTue, 30 Jan 2018 19:09:20 +0000
reviewerslsalzman
bugs1428182
milestone60.0a1
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
gfx/skia/skia/src/core/SkCpu.cpp
--- 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;