[x264-devel] [PATCH] Add x264_cpu_detect() for NetBSD/macppc.

BugMaster BugMaster at narod.ru
Sun Aug 6 20:15:48 UTC 2023


On Sun, 18 Dec 2022 13:57:43 +0100, Martin Husemann wrote:
> The altivec instruction set detection is very similar to FreeBSD
> and OpenBSD, but uses slightly different sysctl selectors.

> Without this change there is no x264_cpu_detect() function compiled
> for NetBSD/macppc and linking fails.

> ---
>  common/cpu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

> diff --git a/common/cpu.c b/common/cpu.c
> index 41a4c1d7..9acb37e8 100644
> --- a/common/cpu.c
> +++ b/common/cpu.c
> @@ -305,7 +305,7 @@ uint32_t x264_cpu_detect( void )
>  
>  #elif HAVE_ALTIVEC
>  
> -#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
> +#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD || SYS_NETBSD
>  
>  uint32_t x264_cpu_detect( void )
>  {
> @@ -320,6 +320,8 @@ uint32_t x264_cpu_detect( void )
>      size_t   length = sizeof( has_altivec );
>  #if SYS_MACOSX || SYS_OPENBSD
>      int      error = sysctl( selectors, 2, &has_altivec, &length, NULL, 0 );
> +#elif SYS_NETBSD
> +    int      error = sysctlbyname( "machdep.altivec", &has_altivec, &length, NULL, 0 );
>  #else
>      int      error = sysctlbyname( "hw.altivec", &has_altivec, &length, NULL, 0 );
>  #endif

Hi. Shouldn't it be the same as for SYS_OPENBSD i.e. to use sysctl
with selectors and not sysctlbyname? Does NetBSD have this constants?



More information about the x264-devel mailing list