View | Details | Raw Unified | Return to bug 223014 | Differences between
and this patch

Collapse All | Expand All

(-)graphics/mesa-dri/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	mesa-dri
4
PORTNAME=	mesa-dri
5
PORTVERSION=	${MESAVERSION}
5
PORTVERSION=	${MESAVERSION}
6
PORTREVISION=	1
6
CATEGORIES=	graphics
7
CATEGORIES=	graphics
7
8
8
COMMENT=	OpenGL hardware acceleration drivers for DRI2+
9
COMMENT=	OpenGL hardware acceleration drivers for DRI2+
(-)graphics/mesa-dri/files/patch-src_gallium_auxiliary_util_u__cpu__detect.c (+70 lines)
Line 0 Link Here
1
Assume NEON if targeting NEON-capable hardware, detect otherwise
2
Don't rely on SIGILL but use sysctl to detect AltiVec on powerpc*
3
4
--- src/gallium/auxiliary/util/u_cpu_detect.c.orig	2017-10-02 15:49:02 UTC
5
+++ src/gallium/auxiliary/util/u_cpu_detect.c
6
@@ -53,8 +53,9 @@
7
 #endif
8
 
9
 #if defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_DRAGONFLY)
10
-#include <sys/types.h>
11
+#include <sys/param.h>
12
 #include <sys/sysctl.h>
13
+#include <elf.h>
14
 #endif
15
 
16
 #if defined(PIPE_OS_LINUX)
17
@@ -112,13 +113,21 @@ sigill_handler(int sig)
18
 static void
19
 check_os_altivec_support(void)
20
 {
21
+#if defined(PIPE_OS_APPLE) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD)
22
 #if defined(PIPE_OS_APPLE)
23
    int sels[2] = {CTL_HW, HW_VECTORUNIT};
24
+#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD)
25
+   int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
26
+#endif
27
    int has_vu = 0;
28
    int len = sizeof (has_vu);
29
    int err;
30
 
31
+#if defined(PIPE_OS_FREEBSD)
32
+   err = sysctlbyname("hw.altivec", &has_vu, &len, NULL, 0 );
33
+#else
34
    err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
35
+#endif
36
 
37
    if (err == 0) {
38
       if (has_vu != 0) {
39
@@ -311,13 +320,30 @@ check_os_arm_support(void)
40
     * used. Because of this we cannot use PIPE_OS_ANDROID here, but rather
41
     * have a separate macro that only gets enabled from respective Android.mk.
42
     */
43
-#if defined(HAS_ANDROID_CPUFEATURES)
44
+#if defined(__ARM_NEON)
45
+   util_cpu_caps.has_neon = 1;
46
+#elif defined(HAS_ANDROID_CPUFEATURES)
47
    AndroidCpuFamily cpu_family = android_getCpuFamily();
48
    uint64_t cpu_features = android_getCpuFeatures();
49
 
50
    if (cpu_family == ANDROID_CPU_FAMILY_ARM) {
51
       if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON)
52
          util_cpu_caps.has_neon = 1;
53
+   }
54
+#elif defined(PIPE_OS_FREEBSD) && defined(HWCAP_NEON)
55
+   Elf_Auxinfo auxv[AT_COUNT];
56
+   size_t len = sizeof(auxv);
57
+   int mib[] = {
58
+      CTL_KERN,
59
+      KERN_PROC,
60
+      KERN_PROC_AUXV,
61
+      getpid(),
62
+   };
63
+
64
+   if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) {
65
+      for (size_t i = 0; i < nitems(auxv); i++)
66
+         if (auxv[i].a_type == AT_HWCAP && auxv[i].a_un.a_val & HWCAP_NEON)
67
+             util_cpu_caps.has_neon = 1;
68
    }
69
 #elif defined(PIPE_OS_LINUX)
70
     Elf32_auxv_t aux;

Return to bug 223014