From 30ec0b3735d5f728c2aea4184736a3e286a5ccda Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 7 Feb 2017 18:03:15 -0500 Subject: Simplify SkCpu.cpp preprocessor guards. We have a couple ways to detect CPU features on ARM: - on ARMv8, getauxval(AT_HWCAP) - on ARMv7, getauxval(AT_HWCAP) and cpu-features.h This guards each of these methods with preprocessor guards to match exactly when we can use them. Today they're sort of a mix of that and higher level expectations about particular build and operating systems. I'm looking into doing this directly by reading CPU registers, much like we do for x86 further up the file. None of this is super important right now, so as long as we don't decide that we have these features when we don't, things will be fine. It's no big deal for now if we fail to detect them. Change-Id: I3b7768483086d0f3f4f6516b754c3ea5ec2d03e5 Reviewed-on: https://skia-review.googlesource.com/8182 Reviewed-by: Chinmay Garde Reviewed-by: Mike Klein Commit-Queue: Mike Klein --- src/core/SkCpu.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/SkCpu.cpp b/src/core/SkCpu.cpp index 1ae6723983..5e5b3169c7 100644 --- a/src/core/SkCpu.cpp +++ b/src/core/SkCpu.cpp @@ -62,7 +62,7 @@ return features; } -#elif defined(SK_CPU_ARM64) && defined(SK_BUILD_FOR_ANDROID) +#elif defined(SK_CPU_ARM64) && __has_include() && __has_include() #include #include @@ -73,9 +73,8 @@ return features; } -#elif defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR_ANDROID) && \ - __has_include() && __has_include() - // asm/hwcap.h and sys/auxv.h won't be present on builds targeting NDK APIs before 21. +#elif defined(SK_CPU_ARM32) && __has_include() && __has_include() + // asm/hwcap.h and sys/auxv.h won't be present on NDK builds before API v21. #include #include @@ -86,8 +85,7 @@ return features; } -#elif defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR_ANDROID) && \ - !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) +#elif defined(SK_CPU_ARM32) && __has_include() #include static uint32_t read_cpu_features() { -- cgit v1.2.3