FreeBSD Bugzilla – Attachment 207539 Details for
Bug 223014
graphics/mesa-dri: enable NEON and AltiVec
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v1
mesa-dri.neon-altivec.v1.diff (text/plain), 4.12 KB, created by
Jan Beich
on 2019-09-16 14:38:24 UTC
(
hide
)
Description:
v1
Filename:
MIME Type:
Creator:
Jan Beich
Created:
2019-09-16 14:38:24 UTC
Size:
4.12 KB
patch
obsolete
>From e20e953b701414f54b1b040f9e7edf53301201b2 Mon Sep 17 00:00:00 2001 >From: Jan Beich <jbeich@FreeBSD.org> >Date: Mon, 16 Sep 2019 14:31:36 +0000 >Subject: [PATCH] graphics/mesa-dri: improve SIMD detection on non-x86 > >PR: 223014 >Approved by: maintainer timeout >--- > graphics/mesa-dri/Makefile | 2 +- > .../files/patch-src_util_u__cpu__detect.c | 95 +++++++++++++++++++ > 2 files changed, 96 insertions(+), 1 deletion(-) > create mode 100644 graphics/mesa-dri/files/patch-src_util_u__cpu__detect.c > >diff --git a/graphics/mesa-dri/Makefile b/graphics/mesa-dri/Makefile >index d89fc4ee1d6da..7e3a4796157bb 100644 >--- a/graphics/mesa-dri/Makefile >+++ b/graphics/mesa-dri/Makefile >@@ -3,7 +3,7 @@ > > PORTNAME= mesa-dri > PORTVERSION= ${MESAVERSION} >-PORTREVISION= 4 >+PORTREVISION= 5 > CATEGORIES= graphics > > COMMENT= OpenGL hardware acceleration drivers for DRI2+ >diff --git a/graphics/mesa-dri/files/patch-src_util_u__cpu__detect.c b/graphics/mesa-dri/files/patch-src_util_u__cpu__detect.c >new file mode 100644 >index 0000000000000..5451996fc9a43 >--- /dev/null >+++ b/graphics/mesa-dri/files/patch-src_util_u__cpu__detect.c >@@ -0,0 +1,95 @@ >+- Detect NEON/AltiVec/VSX on FreeBSD >+ >+--- src/util/u_cpu_detect.c.orig 2019-01-17 11:26:23 UTC >++++ src/util/u_cpu_detect.c >+@@ -47,16 +47,18 @@ >+ #endif >+ #endif >+ >+-#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) >++#if defined(PIPE_OS_BSD) >+ #include <sys/param.h> >+ #include <sys/sysctl.h> >+ #include <machine/cpu.h> >+ #endif >+ >+-#if defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_DRAGONFLY) >+-#include <sys/types.h> >+-#include <sys/sysctl.h> >++#if defined(PIPE_OS_FREEBSD) >++#if __has_include(<sys/auxv.h>) >++#include <sys/auxv.h> >++#define HAVE_ELF_AUX_INFO >+ #endif >++#endif >+ >+ #if defined(PIPE_OS_LINUX) >+ #include <signal.h> >+@@ -92,7 +94,7 @@ static int has_cpuid(void); >+ #endif >+ >+ >+-#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) >++#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) && !defined(PIPE_OS_BSD) >+ static jmp_buf __lv_powerpc_jmpbuf; >+ static volatile sig_atomic_t __lv_powerpc_canjump = 0; >+ >+@@ -113,8 +115,20 @@ sigill_handler(int sig) >+ static void >+ check_os_altivec_support(void) >+ { >+-#if defined(PIPE_OS_APPLE) >++#if defined(__ALTIVEC__) >++ util_cpu_caps.has_altivec = 1; >++#endif >++#if defined(__VSX__) >++ util_cpu_caps.has_vsx = 1; >++#endif >++#if defined(__ALTIVEC__) && defined(__VSX__) >++/* Do nothing */ >++#elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) >++#ifdef HW_VECTORUNIT >+ int sels[2] = {CTL_HW, HW_VECTORUNIT}; >++#else >++ int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC}; >++#endif >+ int has_vu = 0; >+ int len = sizeof (has_vu); >+ int err; >+@@ -126,7 +140,19 @@ check_os_altivec_support(void) >+ util_cpu_caps.has_altivec = 1; >+ } >+ } >+-#else /* !PIPE_OS_APPLE */ >++#elif defined(PIPE_OS_FREEBSD) /* !PIPE_OS_APPLE && !PIPE_OS_NETBSD && !PIPE_OS_OPENBSD */ >++ unsigned long hwcap = 0; >++#ifdef HAVE_ELF_AUX_INFO >++ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); >++#else >++ size_t len = sizeof(hwcap); >++ sysctlbyname("hw.cpu_features", &hwcap, &len, NULL, 0); >++#endif >++ if (hwcap & PPC_FEATURE_HAS_ALTIVEC) >++ util_cpu_caps.has_altivec = 1; >++ if (hwcap & PPC_FEATURE_HAS_VSX) >++ util_cpu_caps.has_vsx = 1; >++#else /* !PIPE_OS_APPLE && !PIPE_OS_BSD */ >+ /* not on Apple/Darwin, do it the brute-force way */ >+ /* this is borrowed from the libmpeg2 library */ >+ signal(SIGILL, sigill_handler); >+@@ -339,7 +365,14 @@ check_os_arm_support(void) >+ * used. Because of this we cannot use PIPE_OS_ANDROID here, but rather >+ * have a separate macro that only gets enabled from respective Android.mk. >+ */ >+-#if defined(HAS_ANDROID_CPUFEATURES) >++#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(); >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223014
:
187176
|
187177
| 207539