ping.
On 2025-02-14 3:08 a.m., Brad Smith wrote:
Here is a diff for libvpx to add PowerPC CPU feature detection for
PowerPC64 instead of the stub just to build.
Needs testing on PowerPC64.
Index: Makefile
===================================================================
RCS file: /cvs/ports/multimedia/libvpx/Makefile,v
retrieving revision 1.61
diff -u -p -u -p -r1.61 Makefile
--- Makefile 24 Nov 2024 08:38:14 -0000 1.61
+++ Makefile 14 Feb 2025 07:25:16 -0000
@@ -4,6 +4,7 @@ GH_ACCOUNT= webmproject
GH_PROJECT= libvpx
GH_TAGNAME= v1.15.0
EPOCH= 0
+REVISION= 0
CATEGORIES= multimedia
SHARED_LIBS= vpx 18.0
Index: patches/patch-vpx_ports_aarch32_cpudetect_c
===================================================================
RCS file:
/cvs/ports/multimedia/libvpx/patches/patch-vpx_ports_aarch32_cpudetect_c,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-vpx_ports_aarch32_cpudetect_c
--- patches/patch-vpx_ports_aarch32_cpudetect_c 24 Nov 2024 08:38:14 -0000
1.3
+++ patches/patch-vpx_ports_aarch32_cpudetect_c 14 Feb 2025 07:25:16 -0000
@@ -1,4 +1,4 @@
-Allow ARM CPU runtime detection code to build on OpenBSD.
+Add ARM CPU feature detection support for OpenBSD.
Index: vpx_ports/aarch32_cpudetect.c
--- vpx_ports/aarch32_cpudetect.c.orig
Index: patches/patch-vpx_ports_ppc_cpudetect_c
===================================================================
RCS file: /cvs/ports/multimedia/libvpx/patches/patch-vpx_ports_ppc_cpudetect_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-vpx_ports_ppc_cpudetect_c
--- patches/patch-vpx_ports_ppc_cpudetect_c 11 Mar 2022 19:39:22 -0000
1.2
+++ patches/patch-vpx_ports_ppc_cpudetect_c 14 Feb 2025 07:25:16 -0000
@@ -1,31 +1,70 @@
-Allow PowerPC CPU runtime detection code to build on OpenBSD.
+Add PowerPC CPU feature detection support for OpenBSD.
Index: vpx_ports/ppc_cpudetect.c
--- vpx_ports/ppc_cpudetect.c.orig
+++ vpx_ports/ppc_cpudetect.c
-@@ -8,16 +8,19 @@
+@@ -8,11 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-+#if defined(__linux__)
- #include <fcntl.h>
+-#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
- #include <asm/cputable.h>
- #include <linux/auxvec.h>
-+#endif
+-#include <asm/cputable.h>
+-#include <linux/auxvec.h>
#include "./vpx_config.h"
#include "vpx_ports/ppc.h"
+@@ -35,6 +32,12 @@ static int cpu_env_mask(void) {
+ return env && *env ? (int)strtol(env, NULL, 0) : ~0;
+ }
- #if CONFIG_RUNTIME_CPU_DETECT
+#if defined(__linux__)
- static int cpu_env_flags(int *flags) {
- char *env;
- env = getenv("VPX_SIMD_CAPS");
-@@ -77,4 +80,5 @@ out_close:
- // If there is no RTCD the function pointers are not used and can not be
- // changed.
- int ppc_simd_caps(void) { return 0; }
++
++#include <fcntl.h>
++#include <asm/cputable.h>
++#include <linux/auxvec.h>
++
+ int ppc_simd_caps(void) {
+ int flags;
+ int mask;
+@@ -71,6 +74,39 @@ int ppc_simd_caps(void) {
+ }
+ out_close:
+ close(fd);
++ return flags & mask;
++}
++
++#elif defined(__OpenBSD__)
++
++#include <sys/auxv.h>
++
++// Define hwcap values ourselves: building with an old auxv header where these
++// hwcap values are not defined should not prevent features from being
enabled.
++#define VPX_PPC_HWCAP_VSX (1 << 7)
++
++int ppc_simd_caps(void) {
++ int flags;
++ int mask;
++
++ // If VPX_SIMD_CAPS is set then allow only those capabilities.
++ if (!cpu_env_flags(&flags)) {
++ return flags;
++ }
++
++ mask = cpu_env_mask();
++
++#ifdef __OpenBSD__
++ unsigned long hwcap = 0;
++ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
++#else
++ unsigned long hwcap = getauxval(AT_HWCAP);
+#endif
- #endif // CONFIG_RUNTIME_CPU_DETECT
++#if HAVE_VSX
++ if (hwcap & VPX_PPC_HWCAP_VSX) {
++ flags |= HAS_VSX;
++ }
++#endif // HAVE_VSX
+ return flags & mask;
+ }
+ #else