OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 The Android Open Source Project | 3 * Copyright 2012 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkUtilsArm.h" | 9 #include "SkUtilsArm.h" |
10 | 10 |
11 #if SK_ARM_NEON_IS_DYNAMIC | 11 #if SK_ARM_NEON_IS_DYNAMIC |
12 | 12 |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 #include <fcntl.h> | 14 #include <fcntl.h> |
15 #include <errno.h> | 15 #include <errno.h> |
16 #include <string.h> | 16 #include <string.h> |
17 #include <pthread.h> | 17 #include <pthread.h> |
18 | 18 |
19 // Set USE_ANDROID_NDK_CPU_FEATURES to use the Android NDK's | 19 // Set USE_ANDROID_NDK_CPU_FEATURES to use the Android NDK's |
20 // cpu-features helper library to detect NEON at runtime. See | 20 // cpu-features helper library to detect NEON at runtime. See |
21 // http://crbug.com/164154 to see why this is needed in Chromium | 21 // http://crbug.com/164154 to see why this is needed in Chromium |
22 // for Android. | 22 // for Android. |
23 #if defined(SK_BUILD_FOR_ANDROID) && defined(SK_BUILD_FOR_CHROMIUM) | 23 #if defined(SK_BUILD_FOR_ANDROID) |
24 # define USE_ANDROID_NDK_CPU_FEATURES 1 | 24 # define USE_ANDROID_NDK_CPU_FEATURES 1 |
25 #else | 25 #else |
26 # define USE_ANDROID_NDK_CPU_FEATURES 0 | 26 # define USE_ANDROID_NDK_CPU_FEATURES 0 |
27 #endif | 27 #endif |
28 | 28 |
29 #if USE_ANDROID_NDK_CPU_FEATURES | 29 #if USE_ANDROID_NDK_CPU_FEATURES |
30 # include <cpu-features.h> | 30 # include <cpu-features.h> |
31 #endif | 31 #endif |
32 | 32 |
33 // Set NEON_DEBUG to 1 to allow debugging of the CPU features probing. | 33 // Set NEON_DEBUG to 1 to allow debugging of the CPU features probing. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void sk_cpu_arm_probe_features(void) { | 188 void sk_cpu_arm_probe_features(void) { |
189 sHasArmNeon = sk_cpu_arm_check_neon(); | 189 sHasArmNeon = sk_cpu_arm_check_neon(); |
190 } | 190 } |
191 | 191 |
192 bool sk_cpu_arm_has_neon(void) { | 192 bool sk_cpu_arm_has_neon(void) { |
193 pthread_once(&sOnce, sk_cpu_arm_probe_features); | 193 pthread_once(&sOnce, sk_cpu_arm_probe_features); |
194 return sHasArmNeon; | 194 return sHasArmNeon; |
195 } | 195 } |
196 | 196 |
197 #endif // SK_ARM_NEON_IS_DYNAMIC | 197 #endif // SK_ARM_NEON_IS_DYNAMIC |
OLD | NEW |