Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: source/libvpx/vpx_ports/arm_cpudetect.c

Issue 756673003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vpx/vpx_encoder.h ('k') | source/libvpx/vpx_scale/vpx_scale.mk » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 int arm_cpu_caps(void) { 42 int arm_cpu_caps(void) {
43 /* This function should actually be a no-op. There is no way to adjust any of 43 /* This function should actually be a no-op. There is no way to adjust any of
44 * these because the RTCD tables do not exist: the functions are called 44 * these because the RTCD tables do not exist: the functions are called
45 * statically */ 45 * statically */
46 int flags; 46 int flags;
47 int mask; 47 int mask;
48 if (!arm_cpu_env_flags(&flags)) { 48 if (!arm_cpu_env_flags(&flags)) {
49 return flags; 49 return flags;
50 } 50 }
51 mask = arm_cpu_env_mask(); 51 mask = arm_cpu_env_mask();
52 #if HAVE_EDSP
53 flags |= HAS_EDSP;
54 #endif /* HAVE_EDSP */
55 #if HAVE_MEDIA 52 #if HAVE_MEDIA
56 flags |= HAS_MEDIA; 53 flags |= HAS_MEDIA;
57 #endif /* HAVE_MEDIA */ 54 #endif /* HAVE_MEDIA */
58 #if HAVE_NEON || HAVE_NEON_ASM 55 #if HAVE_NEON || HAVE_NEON_ASM
59 flags |= HAS_NEON; 56 flags |= HAS_NEON;
60 #endif /* HAVE_NEON || HAVE_NEON_ASM */ 57 #endif /* HAVE_NEON || HAVE_NEON_ASM */
61 return flags & mask; 58 return flags & mask;
62 } 59 }
63 60
64 #elif defined(_MSC_VER) /* end !CONFIG_RUNTIME_CPU_DETECT */ 61 #elif defined(_MSC_VER) /* end !CONFIG_RUNTIME_CPU_DETECT */
65 /*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/ 62 /*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
66 #define WIN32_LEAN_AND_MEAN 63 #define WIN32_LEAN_AND_MEAN
67 #define WIN32_EXTRA_LEAN 64 #define WIN32_EXTRA_LEAN
68 #include <windows.h> 65 #include <windows.h>
69 66
70 int arm_cpu_caps(void) { 67 int arm_cpu_caps(void) {
71 int flags; 68 int flags;
72 int mask; 69 int mask;
73 if (!arm_cpu_env_flags(&flags)) { 70 if (!arm_cpu_env_flags(&flags)) {
74 return flags; 71 return flags;
75 } 72 }
76 mask = arm_cpu_env_mask(); 73 mask = arm_cpu_env_mask();
77 /* MSVC has no inline __asm support for ARM, but it does let you __emit 74 /* MSVC has no inline __asm support for ARM, but it does let you __emit
78 * instructions via their assembled hex code. 75 * instructions via their assembled hex code.
79 * All of these instructions should be essentially nops. 76 * All of these instructions should be essentially nops.
80 */ 77 */
81 #if HAVE_EDSP
82 if (mask & HAS_EDSP) {
83 __try {
84 /*PLD [r13]*/
85 __emit(0xF5DDF000);
86 flags |= HAS_EDSP;
87 } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
88 /*Ignore exception.*/
89 }
90 }
91 #endif /* HAVE_EDSP */
92 #if HAVE_MEDIA 78 #if HAVE_MEDIA
93 if (mask & HAS_MEDIA) 79 if (mask & HAS_MEDIA)
94 __try { 80 __try {
95 /*SHADD8 r3,r3,r3*/ 81 /*SHADD8 r3,r3,r3*/
96 __emit(0xE6333F93); 82 __emit(0xE6333F93);
97 flags |= HAS_MEDIA; 83 flags |= HAS_MEDIA;
98 } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) { 84 } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
99 /*Ignore exception.*/ 85 /*Ignore exception.*/
100 } 86 }
101 } 87 }
(...skipping 18 matching lines...) Expand all
120 int arm_cpu_caps(void) { 106 int arm_cpu_caps(void) {
121 int flags; 107 int flags;
122 int mask; 108 int mask;
123 uint64_t features; 109 uint64_t features;
124 if (!arm_cpu_env_flags(&flags)) { 110 if (!arm_cpu_env_flags(&flags)) {
125 return flags; 111 return flags;
126 } 112 }
127 mask = arm_cpu_env_mask(); 113 mask = arm_cpu_env_mask();
128 features = android_getCpuFeatures(); 114 features = android_getCpuFeatures();
129 115
130 #if HAVE_EDSP
131 flags |= HAS_EDSP;
132 #endif /* HAVE_EDSP */
133 #if HAVE_MEDIA 116 #if HAVE_MEDIA
134 flags |= HAS_MEDIA; 117 flags |= HAS_MEDIA;
135 #endif /* HAVE_MEDIA */ 118 #endif /* HAVE_MEDIA */
136 #if HAVE_NEON || HAVE_NEON_ASM 119 #if HAVE_NEON || HAVE_NEON_ASM
137 if (features & ANDROID_CPU_ARM_FEATURE_NEON) 120 if (features & ANDROID_CPU_ARM_FEATURE_NEON)
138 flags |= HAS_NEON; 121 flags |= HAS_NEON;
139 #endif /* HAVE_NEON || HAVE_NEON_ASM */ 122 #endif /* HAVE_NEON || HAVE_NEON_ASM */
140 return flags & mask; 123 return flags & mask;
141 } 124 }
142 125
(...skipping 13 matching lines...) Expand all
156 * on Android. 139 * on Android.
157 * This also means that detection will fail in Scratchbox. 140 * This also means that detection will fail in Scratchbox.
158 */ 141 */
159 fin = fopen("/proc/cpuinfo", "r"); 142 fin = fopen("/proc/cpuinfo", "r");
160 if (fin != NULL) { 143 if (fin != NULL) {
161 /* 512 should be enough for anybody (it's even enough for all the flags 144 /* 512 should be enough for anybody (it's even enough for all the flags
162 * that x86 has accumulated... so far). 145 * that x86 has accumulated... so far).
163 */ 146 */
164 char buf[512]; 147 char buf[512];
165 while (fgets(buf, 511, fin) != NULL) { 148 while (fgets(buf, 511, fin) != NULL) {
166 #if HAVE_EDSP || HAVE_NEON || HAVE_NEON_ASM 149 #if HAVE_NEON || HAVE_NEON_ASM
167 if (memcmp(buf, "Features", 8) == 0) { 150 if (memcmp(buf, "Features", 8) == 0) {
168 char *p; 151 char *p;
169 #if HAVE_EDSP
170 p = strstr(buf, " edsp");
171 if (p != NULL && (p[5] == ' ' || p[5] == '\n')) {
172 flags |= HAS_EDSP;
173 }
174 #endif /* HAVE_EDSP */
175 #if HAVE_NEON || HAVE_NEON_ASM
176 p = strstr(buf, " neon"); 152 p = strstr(buf, " neon");
177 if (p != NULL && (p[5] == ' ' || p[5] == '\n')) { 153 if (p != NULL && (p[5] == ' ' || p[5] == '\n')) {
178 flags |= HAS_NEON; 154 flags |= HAS_NEON;
179 } 155 }
156 }
180 #endif /* HAVE_NEON || HAVE_NEON_ASM */ 157 #endif /* HAVE_NEON || HAVE_NEON_ASM */
181 }
182 #endif /* HAVE_EDSP || HAVE_NEON || HAVE_NEON_ASM */
183 #if HAVE_MEDIA 158 #if HAVE_MEDIA
184 if (memcmp(buf, "CPU architecture:", 17) == 0) { 159 if (memcmp(buf, "CPU architecture:", 17) == 0) {
185 int version; 160 int version;
186 version = atoi(buf + 17); 161 version = atoi(buf + 17);
187 if (version >= 6) { 162 if (version >= 6) {
188 flags |= HAS_MEDIA; 163 flags |= HAS_MEDIA;
189 } 164 }
190 } 165 }
191 #endif /* HAVE_MEDIA */ 166 #endif /* HAVE_MEDIA */
192 } 167 }
193 fclose(fin); 168 fclose(fin);
194 } 169 }
195 return flags & mask; 170 return flags & mask;
196 } 171 }
197 #else /* end __linux__ */ 172 #else /* end __linux__ */
198 #error "--enable-runtime-cpu-detect selected, but no CPU detection method " \ 173 #error "--enable-runtime-cpu-detect selected, but no CPU detection method " \
199 "available for your platform. Reconfigure with --disable-runtime-cpu-detect." 174 "available for your platform. Reconfigure with --disable-runtime-cpu-detect."
200 #endif 175 #endif
OLDNEW
« no previous file with comments | « source/libvpx/vpx/vpx_encoder.h ('k') | source/libvpx/vpx_scale/vpx_scale.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698