Re: git: 5d97e86feed9 - main - www/*chromium: unbreak arm64 by implementing the missing cpudetect code

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 08 Jan 2024 21:33:28 UTC
Robert Nagy <rnagy@FreeBSD.org> writes:

> diff --git a/www/chromium/files/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c b/www/chromium/files/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
> new file mode 100644
> index 000000000000..92163a805c0c
> --- /dev/null
> +++ b/www/chromium/files/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
> @@ -0,0 +1,20 @@
> +--- third_party/libvpx/source/libvpx/vpx_ports/aarch64_cpudetect.c.orig	2024-01-08 12:52:53 UTC
> ++++ third_party/libvpx/source/libvpx/vpx_ports/aarch64_cpudetect.c
> +@@ -153,7 +153,16 @@ static int arm_get_cpu_caps(void) {
> +   return flags;
> + }
> + 
> +-#else  // end __Fuchsia__
> ++#elif defined(__FreeBSD__)  // end __Fuchsia__
> ++
> ++int arm_get_cpu_caps(void) {
> ++  int flags = 0;
> ++#if HAVE_NEON
> ++  flags |= HAS_NEON;  // Neon is mandatory in Armv8.0-A.
> ++#endif  // HAVE_NEON
> ++  return flags;
> ++}
> ++#else  // end __FreeBSD__
> + #error \
> +     "Runtime CPU detection selected, but no CPU detection method available" \
> + "for your platform. Rerun configure with --disable-runtime-cpu-detect."
> diff --git a/www/ungoogled-chromium/files/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c b/www/ungoogled-chromium/files/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c

Better sync with multimedia/aom/files/patch-aom__ports_aarch64__cpudetect.c
libvpx has some aarch64 SIMD code not supported by aarch32 e.g.,

vpx_dsp/vpx_dsp.mk
143:DSP_SRCS-$(HAVE_NEON_I8MM) += arm/vpx_convolve8_neon_i8mm.c
144:DSP_SRCS-$(HAVE_NEON_I8MM) += arm/vpx_convolve_neon_i8mm.c

vpx_dsp/vpx_dsp.mk
40:DSP_SRCS-$(HAVE_NEON_DOTPROD) += arm/sse_neon_dotprod.c
141:DSP_SRCS-$(HAVE_NEON_DOTPROD) += arm/vpx_convolve8_neon_dotprod.c
142:DSP_SRCS-$(HAVE_NEON_DOTPROD) += arm/vpx_convolve_neon_dotprod.c
381:DSP_SRCS-$(HAVE_NEON_DOTPROD) += arm/sad4d_neon_dotprod.c
383:DSP_SRCS-$(HAVE_NEON_DOTPROD) += arm/sad_neon_dotprod.c
426:DSP_SRCS-$(HAVE_NEON_DOTPROD)   += arm/variance_neon_dotprod.c