ports/multimedia/libvpx/files/patch-vpx__ports_arm__cpudetect.c
Rene Ladan 620968a43a cleanup: drop support for EOL FreeBSD 11.X
Search criteria used:
- 11.4
- OSREL*
- OSVER*
- *_FreeBSD_11

Input from:
- adridg: devel/qca-legacy
- jbeich: _WITH_DPRINTF, _WITH_GETLINE, GNU bfd workarounds
- sunpoet: security/p5-*OpenSSL*

Reviewed by:	doceng, kde, multimedia, perl, python, ruby, rust
Differential Revision: https://reviews.freebsd.org/D32008
Test Plan: make index
2021-09-30 23:23:30 +02:00

38 lines
1.1 KiB
C

--- vpx_ports/arm_cpudetect.c.orig 2021-03-18 19:59:46 UTC
+++ vpx_ports/arm_cpudetect.c
@@ -38,7 +38,7 @@ static int arm_cpu_env_mask(void) {
return env && *env ? (int)strtol(env, NULL, 0) : ~0;
}
-#if !CONFIG_RUNTIME_CPU_DETECT
+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__ARM_NEON)
int arm_cpu_caps(void) {
/* This function should actually be a no-op. There is no way to adjust any of
@@ -147,7 +147,25 @@ int arm_cpu_caps(void) {
}
return flags & mask;
}
-#else /* end __linux__ */
+#elif defined(__FreeBSD__)
+
+#include <sys/auxv.h>
+
+int arm_cpu_caps(void) {
+ int flags;
+ int mask;
+ u_long hwcap = 0;
+ if (!arm_cpu_env_flags(&flags)) {
+ return flags;
+ }
+ mask = arm_cpu_env_mask();
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
+#if HAVE_NEON || HAVE_NEON_ASM
+ if (hwcap & HWCAP_NEON) flags |= HAS_NEON;
+#endif
+ return flags & mask;
+}
+#else /* end __FreeBSD__ */
#error \
"--enable-runtime-cpu-detect selected, but no CPU detection method " \
"available for your platform. Reconfigure with --disable-runtime-cpu-detect."