aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-06-06 10:43:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-06 15:57:15 +0000
commitc665fddeab30dde8f43862d2e8381f4c73e80079 (patch)
tree393088225536b2ccf1b7e59768fe8c891746677a /src
parent0e36b3f9307a90f65b7f5e351818223bcb1b64a9 (diff)
define HWCAP_* ourselves in SkCpu.cpp
For compatibility with older system headers, instead of looking for HWCAP_ values in asm/hwcap.h, just define the bits we want to test ourselves. This lets us compile this code on systems before those bits were defined. At runtime the bits will harmlessly test as zero. Change-Id: I44b6aba7d6f0fc2c5df08ad262c2b0537d900209 Reviewed-on: https://skia-review.googlesource.com/18844 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkCpu.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/SkCpu.cpp b/src/core/SkCpu.cpp
index d90e482c70..42b754f0dc 100644
--- a/src/core/SkCpu.cpp
+++ b/src/core/SkCpu.cpp
@@ -74,23 +74,25 @@
return features;
}
-#elif defined(SK_CPU_ARM64) && __has_include(<asm/hwcap.h>) && __has_include(<sys/auxv.h>)
- #include <asm/hwcap.h>
+#elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
#include <sys/auxv.h>
static uint32_t read_cpu_features() {
+ const uint32_t HWCAP_CRC32 = (1<<7);
+
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.
- #include <asm/hwcap.h>
+#elif defined(SK_CPU_ARM32) && __has_include(<sys/auxv.h>)
+ // sys/auxv.h won't be present on NDK builds before API v21.
#include <sys/auxv.h>
static uint32_t read_cpu_features() {
+ const uint32_t HWCAP_VFPv4 = (1<<16);
+
uint32_t features = 0;
uint32_t hwcaps = getauxval(AT_HWCAP);
if (hwcaps & HWCAP_VFPv4) { features |= SkCpu::NEON|SkCpu::NEON_FMA|SkCpu::VFP_FP16; }