Here is a diff to add arm64 CPU feature detection support to aom and libvpx.
Index: aom/Makefile =================================================================== RCS file: /cvs/ports/multimedia/aom/Makefile,v retrieving revision 1.23 diff -u -p -u -p -r1.23 Makefile --- aom/Makefile 7 May 2024 15:01:42 -0000 1.23 +++ aom/Makefile 23 May 2024 05:24:58 -0000 @@ -3,6 +3,7 @@ COMMENT= Alliance for Open Media AV1 vid V= 3.9.0 DISTNAME= libaom-$V PKGNAME= aom-$V +REVISION= 0 CATEGORIES= multimedia SHARED_LIBS= aom 4.2 Index: aom/patches/patch-aom_ports_aarch64_cpudetect_c =================================================================== RCS file: /cvs/ports/multimedia/aom/patches/patch-aom_ports_aarch64_cpudetect_c,v retrieving revision 1.2 diff -u -p -u -p -r1.2 patch-aom_ports_aarch64_cpudetect_c --- aom/patches/patch-aom_ports_aarch64_cpudetect_c 7 May 2024 15:01:42 -0000 1.2 +++ aom/patches/patch-aom_ports_aarch64_cpudetect_c 23 May 2024 05:24:58 -0000 @@ -1,23 +1,38 @@ -Allow ARM CPU runtime detection code to build on OpenBSD. +Add AArch64 CPU feature detection support for OpenBSD. Index: aom_ports/aarch64_cpudetect.c --- aom_ports/aarch64_cpudetect.c.orig +++ aom_ports/aarch64_cpudetect.c -@@ -19,7 +19,7 @@ - #include <sys/sysctl.h> - #endif - --#if !CONFIG_RUNTIME_CPU_DETECT -+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__OpenBSD__) - - static int arm_get_cpu_caps(void) { - // This function should actually be a no-op. There is no way to adjust any of -@@ -32,7 +32,7 @@ static int arm_get_cpu_caps(void) { +@@ -178,7 +178,31 @@ static int arm_get_cpu_caps(void) { return flags; } --#elif defined(__APPLE__) // end !CONFIG_RUNTIME_CPU_DETECT -+#elif defined(__APPLE__) // end !CONFIG_RUNTIME_CPU_DETECT || __OpenBSD__ - - // sysctlbyname() parameter documentation for instruction set characteristics: - // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics +-#else // end __Fuchsia__ ++#elif defined(__OpenBSD__) // end __Fuchsia__ ++ ++#include <sys/sysctl.h> ++#include <machine/cpu.h> ++#include <machine/armreg.h> ++ ++static int arm_get_cpu_caps(void) { ++ int flags = 0; ++ int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; ++ uint64_t isar0 = 0; ++ size_t len = sizeof(isar0); ++ ++ flags |= HAS_NEON; // Neon is mandatory in Armv8.0-A. ++ ++ if (sysctl(isar0_mib, 2, &isar0, &len, NULL, 0) != -1) { ++ if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE) ++ flags |= HAS_ARM_CRC32; ++ if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL) ++ flags |= HAS_NEON_DOTPROD; ++ } ++ ++ return flags; ++} ++ ++#else // end __OpenBSD__ + #error \ + "Runtime CPU detection selected, but no CPU detection method " \ + "available for your platform. Rerun cmake with -DCONFIG_RUNTIME_CPU_DETECT=0." Index: libvpx/Makefile =================================================================== RCS file: /cvs/ports/multimedia/libvpx/Makefile,v retrieving revision 1.57 diff -u -p -u -p -r1.57 Makefile --- libvpx/Makefile 29 Feb 2024 09:43:31 -0000 1.57 +++ libvpx/Makefile 23 May 2024 05:24:58 -0000 @@ -3,6 +3,7 @@ COMMENT= Google VP8/VP9 video codec GH_ACCOUNT= webmproject GH_PROJECT= libvpx GH_TAGNAME= v1.14.0 +REVISION= 0 EPOCH= 0 CATEGORIES= multimedia Index: libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c =================================================================== RCS file: /cvs/ports/multimedia/libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c,v retrieving revision 1.1 diff -u -p -u -p -r1.1 patch-vpx_ports_aarch64_cpudetect_c --- libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c 29 Feb 2024 09:43:31 -0000 1.1 +++ libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c 23 May 2024 05:24:58 -0000 @@ -1,23 +1,36 @@ -Allow ARM CPU runtime detection code to build on OpenBSD. +Add AArch64 CPU feature detection support for OpenBSD. Index: vpx_ports/aarch64_cpudetect.c --- vpx_ports/aarch64_cpudetect.c.orig +++ vpx_ports/aarch64_cpudetect.c -@@ -15,7 +15,7 @@ - #include <sys/sysctl.h> - #endif - --#if !CONFIG_RUNTIME_CPU_DETECT -+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__OpenBSD__) - - static int arm_get_cpu_caps(void) { - // This function should actually be a no-op. There is no way to adjust any of -@@ -28,7 +28,7 @@ static int arm_get_cpu_caps(void) { +@@ -170,7 +170,29 @@ static int arm_get_cpu_caps(void) { return flags; } --#elif defined(__APPLE__) // end !CONFIG_RUNTIME_CPU_DETECT -+#elif defined(__APPLE__) // end !CONFIG_RUNTIME_CPU_DETECT || __OpenBSD__ - - // sysctlbyname() parameter documentation for instruction set characteristics: - // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics +-#else // end __Fuchsia__ ++#elif defined(__OpenBSD__) // end __Fuchsia__ ++ ++#include <sys/sysctl.h> ++#include <machine/cpu.h> ++#include <machine/armreg.h> ++ ++static int arm_get_cpu_caps(void) { ++ int flags = 0; ++ int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; ++ uint64_t isar0 = 0; ++ size_t len = sizeof(isar0); ++ ++ flags |= HAS_NEON; // Neon is mandatory in Armv8.0-A. ++ ++ if (sysctl(isar0_mib, 2, &isar0, &len, NULL, 0) != -1) { ++ if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL) ++ flags |= HAS_NEON_DOTPROD; ++ } ++ ++ return flags; ++} ++ ++#else // end __OpenBSD__ + #error \ + "Runtime CPU detection selected, but no CPU detection method available" \ + "for your platform. Rerun configure with --disable-runtime-cpu-detect."