Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/multimedia/aom/files/patch-aom__ports_aarch32__cpudetect.c
18157 views
1
- Assume NEON is enabled on armv7
2
- Implement runtime detection on FreeBSD
3
4
--- aom_ports/aarch32_cpudetect.c.orig 2023-11-30 23:18:12 UTC
5
+++ aom_ports/aarch32_cpudetect.c
6
@@ -12,7 +12,7 @@
7
8
#include "arm_cpudetect.h"
9
10
-#if !CONFIG_RUNTIME_CPU_DETECT
11
+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__ARM_NEON)
12
13
static int arm_get_cpu_caps(void) {
14
// This function should actually be a no-op. There is no way to adjust any of
15
@@ -55,9 +55,23 @@ static int arm_get_cpu_caps(void) {
16
return flags;
17
}
18
19
-#elif defined(__linux__) // end defined(AOM_USE_ANDROID_CPU_FEATURES)
20
+#elif defined(__linux__) || defined(__FreeBSD__) // end defined(AOM_USE_ANDROID_CPU_FEATURES)
21
22
#include <sys/auxv.h>
23
+
24
+#if defined(__FreeBSD__)
25
+static unsigned long getauxval(unsigned long type)
26
+{
27
+ /* Only AT_HWCAP* return unsigned long */
28
+ if (type != AT_HWCAP && type != AT_HWCAP2) {
29
+ return 0;
30
+ }
31
+
32
+ unsigned long ret = 0;
33
+ elf_aux_info(type, &ret, sizeof(ret));
34
+ return ret;
35
+}
36
+#endif
37
38
// Define hwcap values ourselves: building with an old auxv header where these
39
// hwcap values are not defined should not prevent features from being enabled.
40
41