From owner-svn-ports-all@freebsd.org Tue Dec 4 00:51:32 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E55101310277; Tue, 4 Dec 2018 00:51:31 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DBAC76DF7; Tue, 4 Dec 2018 00:51:31 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3D11DB0D; Tue, 4 Dec 2018 00:51:31 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB40pVqU034780; Tue, 4 Dec 2018 00:51:31 GMT (envelope-from jbeich@FreeBSD.org) Received: (from jbeich@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB40pUTY034777; Tue, 4 Dec 2018 00:51:30 GMT (envelope-from jbeich@FreeBSD.org) Message-Id: <201812040051.wB40pUTY034777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jbeich set sender to jbeich@FreeBSD.org using -f From: Jan Beich Date: Tue, 4 Dec 2018 00:51:30 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r486564 - in head/multimedia: aom/files libvpx/files X-SVN-Group: ports-head X-SVN-Commit-Author: jbeich X-SVN-Commit-Paths: in head/multimedia: aom/files libvpx/files X-SVN-Commit-Revision: 486564 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8DBAC76DF7 X-Spamd-Result: default: False [0.05 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; NEURAL_SPAM_LONG(0.05)[0.050,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.47)[0.475,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 00:51:32 -0000 Author: jbeich Date: Tue Dec 4 00:51:30 2018 New Revision: 486564 URL: https://svnweb.freebsd.org/changeset/ports/486564 Log: multimedia/libvpx: simplify NEON/VSX detection on FreeBSD 12 Modified: head/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c (contents, props changed) head/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c (contents, props changed) head/multimedia/libvpx/files/patch-vpx__ports_arm__cpudetect.c (contents, props changed) head/multimedia/libvpx/files/patch-vpx__ports_ppc__cpudetect.c (contents, props changed) Modified: head/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c ============================================================================== --- head/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c Tue Dec 4 00:51:15 2018 (r486563) +++ head/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c Tue Dec 4 00:51:30 2018 (r486564) @@ -12,16 +12,14 @@ int aom_arm_cpu_caps(void) { /* This function should actually be a no-op. There is no way to adjust any of -@@ -143,7 +143,61 @@ int aom_arm_cpu_caps(void) { +@@ -143,7 +143,57 @@ int aom_arm_cpu_caps(void) { } return flags & mask; } -#else /* end __linux__ */ +#elif defined(__FreeBSD__) + -+#if 0 // __has_include() -+#include -+#else ++#if __FreeBSD__ < 12 +#include +#include +#include @@ -47,31 +45,29 @@ + } + return 0; +} ++#else ++#include +#endif + -+#ifndef AT_HWCAP -+#define AT_HWCAP 25 /* 16 on Linux */ -+#endif -+ -+#ifndef HWCAP_NEON -+#define HWCAP_NEON (1 << 12) -+#endif -+ +int aom_arm_cpu_caps(void) { + int flags; + int mask; -+ unsigned long hwcaps; ++ u_long hwcaps = 0; + if (!arm_cpu_env_flags(&flags)) { + return flags; + } + mask = arm_cpu_env_mask(); ++#if __FreeBSD__ < 12 + hwcaps = getauxval(AT_HWCAP); ++#else ++ elf_aux_info(AT_HWCAP, &hwcaps, sizeof(hwcaps)); ++#endif +#if HAVE_NEON + if (hwcaps & HWCAP_NEON) flags |= HAS_NEON; +#endif + return flags & mask; +} -+#else /* end __FreeBSD__ */ ++#else /* end __FreeBSD__ */ #error \ "--enable-runtime-cpu-detect selected, but no CPU detection method " \ "available for your platform. Reconfigure with --disable-runtime-cpu-detect." Modified: head/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c ============================================================================== --- head/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c Tue Dec 4 00:51:15 2018 (r486563) +++ head/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c Tue Dec 4 00:51:30 2018 (r486564) @@ -29,20 +29,23 @@ int ppc_simd_caps(void) { int flags; int mask; -@@ -75,6 +76,36 @@ out_close: +@@ -75,6 +76,44 @@ out_close: close(fd); return flags & mask; } +#elif defined(__FreeBSD__) ++#if __FreeBSD__ < 12 +#include +#include ++#else ++#include ++#endif +#include + +int ppc_simd_caps(void) { + int flags; + int mask; + u_long cpu_features = 0; -+ size_t sz = sizeof(cpu_features); + + // If AOM_SIMD_CAPS is set then allow only those capabilities. + if (!cpu_env_flags(&flags)) { @@ -51,7 +54,12 @@ + + mask = cpu_env_mask(); + ++#if __FreeBSD__ < 12 ++ size_t sz = sizeof(cpu_features); + sysctlbyname("hw.cpu_features", &cpu_features, &sz, NULL, 0); ++#else ++ elf_aux_info(AT_HWCAP, &cpu_features, sizeof(cpu_features)); ++#endif +#if HAVE_VSX + if (cpu_features & PPC_FEATURE_HAS_VSX) flags |= HAS_VSX; +#endif Modified: head/multimedia/libvpx/files/patch-vpx__ports_arm__cpudetect.c ============================================================================== --- head/multimedia/libvpx/files/patch-vpx__ports_arm__cpudetect.c Tue Dec 4 00:51:15 2018 (r486563) +++ head/multimedia/libvpx/files/patch-vpx__ports_arm__cpudetect.c Tue Dec 4 00:51:30 2018 (r486564) @@ -1,14 +1,13 @@ --- vpx_ports/arm_cpudetect.c.orig 2017-01-12 20:27:27 UTC +++ vpx_ports/arm_cpudetect.c -@@ -147,6 +147,60 @@ int arm_cpu_caps(void) { +@@ -147,7 +147,57 @@ int arm_cpu_caps(void) { } return flags & mask; } +-#else /* end __linux__ */ +#elif defined(__FreeBSD__) + -+#if 0 // __has_include() -+#include -+#else ++#if __FreeBSD__ < 12 +#include +#include +#include @@ -34,30 +33,29 @@ + } + return 0; +} ++#else ++#include +#endif + -+#ifndef AT_HWCAP -+#define AT_HWCAP 25 /* 16 on Linux */ -+#endif -+ -+#ifndef HWCAP_NEON -+#define HWCAP_NEON (1 << 12) -+#endif -+ +int arm_cpu_caps(void) { + int flags; + int mask; -+ unsigned long hwcaps; ++ u_long hwcaps = 0; + if (!arm_cpu_env_flags(&flags)) { + return flags; + } + mask = arm_cpu_env_mask(); ++#if __FreeBSD__ < 12 + hwcaps = getauxval(AT_HWCAP); ++#else ++ elf_aux_info(AT_HWCAP, &hwcaps, sizeof(hwcaps)); ++#endif +#if HAVE_NEON || HAVE_NEON_ASM + if (hwcaps & HWCAP_NEON) flags |= HAS_NEON; +#endif + return flags & mask; +} - #else /* end __linux__ */ ++#else /* end __FreeBSD__ */ #error \ "--enable-runtime-cpu-detect selected, but no CPU detection method " \ + "available for your platform. Reconfigure with --disable-runtime-cpu-detect." Modified: head/multimedia/libvpx/files/patch-vpx__ports_ppc__cpudetect.c ============================================================================== --- head/multimedia/libvpx/files/patch-vpx__ports_ppc__cpudetect.c Tue Dec 4 00:51:15 2018 (r486563) +++ head/multimedia/libvpx/files/patch-vpx__ports_ppc__cpudetect.c Tue Dec 4 00:51:30 2018 (r486564) @@ -27,20 +27,23 @@ int ppc_simd_caps(void) { int flags; int mask; -@@ -73,6 +74,36 @@ out_close: +@@ -73,6 +74,44 @@ out_close: close(fd); return flags & mask; } +#elif defined(__FreeBSD__) ++#if __FreeBSD__ < 12 +#include +#include ++#else ++#include ++#endif +#include + +int ppc_simd_caps(void) { + int flags; + int mask; + u_long cpu_features = 0; -+ size_t sz = sizeof(cpu_features); + + // If VPX_SIMD_CAPS is set then allow only those capabilities. + if (!cpu_env_flags(&flags)) { @@ -49,7 +52,12 @@ + + mask = cpu_env_mask(); + ++#if __FreeBSD__ < 12 ++ size_t sz = sizeof(cpu_features); + sysctlbyname("hw.cpu_features", &cpu_features, &sz, NULL, 0); ++#else ++ elf_aux_info(AT_HWCAP, &cpu_features, sizeof(cpu_features)); ++#endif +#if HAVE_VSX + if (cpu_features & PPC_FEATURE_HAS_VSX) flags |= HAS_VSX; +#endif @@ -60,7 +68,7 @@ +#error \ + "--enable-runtime-cpu-detect selected, but no CPU detection method " \ +"available for your platform. Reconfigure with --disable-runtime-cpu-detect." -+#endif /* end __linux__ */ ++#endif /* end __FreeBSD__ */ #else // If there is no RTCD the function pointers are not used and can not be // changed.