mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
53 lines
1.2 KiB
Diff
53 lines
1.2 KiB
Diff
|
Index: b/src/third_party/webrtc/system_wrappers/source/cpu_features.cc
|
||
|
===================================================================
|
||
|
--- a/src/third_party/webrtc/system_wrappers/source/cpu_features.cc
|
||
|
+++ b/src/third_party/webrtc/system_wrappers/source/cpu_features.cc
|
||
|
@@ -18,6 +18,47 @@
|
||
|
|
||
|
#include "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;
|