Mesa (master): util: detect NEON at runtime on FreeBSD

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 9 19:59:12 UTC 2019


Module: Mesa
Branch: master
Commit: 601a098338a5c276a538d55bde516624aff99a49
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=601a098338a5c276a538d55bde516624aff99a49

Author: Jan Beich <jbeich at FreeBSD.org>
Date:   Mon Sep 16 11:34:28 2019 +0000

util: detect NEON at runtime on FreeBSD

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Jan Beich <jbeich at FreeBSD.org>

---

 src/util/u_cpu_detect.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c
index 387003d6cba..19b21b0aa44 100644
--- a/src/util/u_cpu_detect.c
+++ b/src/util/u_cpu_detect.c
@@ -56,6 +56,10 @@
 #if defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_DRAGONFLY)
 #include <sys/types.h>
 #include <sys/sysctl.h>
+#if __has_include(<sys/auxv.h>)
+#include <sys/auxv.h>
+#define HAVE_ELF_AUX_INFO
+#endif
 #endif
 
 #if defined(PIPE_OS_LINUX)
@@ -362,6 +366,11 @@ check_os_arm_support(void)
     */
 #if defined(__ARM_NEON) || defined(__ARM_NEON__)
    util_cpu_caps.has_neon = 1;
+#elif defined(PIPE_OS_FREEBSD) && defined(HAVE_ELF_AUX_INFO)
+   unsigned long hwcap = 0;
+   elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
+   if (hwcap & HWCAP_NEON)
+      util_cpu_caps.has_neon = 1;
 #elif defined(HAS_ANDROID_CPUFEATURES)
    AndroidCpuFamily cpu_family = android_getCpuFamily();
    uint64_t cpu_features = android_getCpuFeatures();




More information about the mesa-commit mailing list