Commit d4fcb70d authored by Martin Storsjö's avatar Martin Storsjö

arm: Improve use of getauxval in quirky environments

Manually define the necessary HWCAP if sys/auxv.h didn't define
it. (It isn't defined in the Android NDK, one has to include
asm/hwcap.h to get definitions of them. Additionally, the aarch64
cross libc headers in Ubuntu 16.04 lacked HWCAP definitions from
sys/auxv.h, also present in asm/hwcap.h. Ubuntu 16.04's armhf
cross libc headers did however define HWCAP values in sys/auxv.h.)

Don't use any detection at all for NEON on aarch64, since it is a
mandatory feature there. On WSL on Windows 10 1803 arm64,
getauxval(AT_HWCAP) returns 0.
parent 287ba91b
Pipeline #1696 passed with stages
in 4 minutes and 10 seconds
......@@ -29,14 +29,13 @@
#include "src/arm/cpu.h"
#if defined(HAVE_GETAUXVAL)
#if defined(HAVE_GETAUXVAL) && ARCH_ARM
#include <sys/auxv.h>
#if ARCH_AARCH64
#define NEON_HWCAP HWCAP_ASIMD
#elif ARCH_ARM
#define NEON_HWCAP HWCAP_ARM_NEON
#ifndef HWCAP_ARM_NEON
#define HWCAP_ARM_NEON (1 << 12)
#endif
#define NEON_HWCAP HWCAP_ARM_NEON
#elif defined(__ANDROID__)
#include <stdio.h>
......@@ -71,7 +70,9 @@ static unsigned parse_proc_cpuinfo(const char *flag) {
unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = 0;
#if defined(HAVE_GETAUXVAL)
#if ARCH_AARCH64
flags |= DAV1D_ARM_CPU_FLAG_NEON;
#elif defined(HAVE_GETAUXVAL) && ARCH_ARM
unsigned long hw_cap = getauxval(AT_HWCAP);
flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(__ANDROID__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment