-
Notifications
You must be signed in to change notification settings - Fork 0
/
chromium-52.0.2743.82-arm-webrtc.patch
51 lines (49 loc) · 1.37 KB
/
chromium-52.0.2743.82-arm-webrtc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
diff -up chromium-52.0.2743.82/third_party/webrtc/system_wrappers/source/cpu_features.cc.armwebrtc chromium-52.0.2743.82/third_party/webrtc/system_wrappers/source/cpu_features.cc
--- chromium-52.0.2743.82/third_party/webrtc/system_wrappers/source/cpu_features.cc.armwebrtc 2016-08-03 09:30:53.922861020 +0200
+++ chromium-52.0.2743.82/third_party/webrtc/system_wrappers/source/cpu_features.cc 2016-08-03 09:32:00.337498174 +0200
@@ -18,6 +18,47 @@
#include "webrtc/typedefs.h"
+#include <elf.h>
+#ifdef __arm__
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/auxvec.h>
+#include <asm/hwcap.h>
+#endif
+
+#ifdef __arm__
+uint64_t WebRtc_GetCPUFeaturesARM() {
+ static bool detected = false;
+ static uint64_t have_neon = 0;
+
+ int fd;
+ Elf32_auxv_t auxv;
+ unsigned int hwcaps;
+
+ if (!detected) {
+ int fd;
+ Elf32_auxv_t auxv;
+ unsigned int hwcaps;
+
+ fd = open("/proc/self/auxv", O_RDONLY);
+ if (fd >= 0) {
+ while (read(fd, &auxv, sizeof(Elf32_auxv_t)) == sizeof(Elf32_auxv_t)) {
+ if (auxv.a_type == AT_HWCAP) {
+ have_neon = (auxv.a_un.a_val & HWCAP_NEON) ? kCPUFeatureNEON : 0;
+ break;
+ }
+ }
+ close (fd);
+ } else {
+ have_neon = 0;
+ }
+ detected = true;
+ }
+
+ return 0 | have_neon; // others here as we need them
+}
+#endif
+
// No CPU feature is available => straight C path.
int GetCPUInfoNoASM(CPUFeature feature) {
(void)feature;