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

Collapse All | Expand All

(-)b/graphics/mesa-dri/Makefile (-1 / +22 lines)
Lines 29-34 VDPAU_LIB_DEPENDS= libvdpau.so:multimedia/libvdpau Link Here
29
29
30
ALL_DRI_DRIVERS=	I915 I965 RADEON R200 SWRAST
30
ALL_DRI_DRIVERS=	I915 I965 RADEON R200 SWRAST
31
ALL_GALLIUM_DRIVERS=	FREEDRENO R300 R600 RADEONSI SVGA SWRAST VC4
31
ALL_GALLIUM_DRIVERS=	FREEDRENO R300 R600 RADEONSI SVGA SWRAST VC4
32
ALL_VULKAN_DRIVERS=	INTEL RADEON
32
33
33
DRI_DRIVERS=		SWRAST	# classic swrast
34
DRI_DRIVERS=		SWRAST	# classic swrast
34
.if "${MESA_LLVM_VER}" != ""
35
.if "${MESA_LLVM_VER}" != ""
Lines 36-47 GALLIUM_DRIVERS= SWRAST # llvmpipe Link Here
36
.else
37
.else
37
GALLIUM_DRIVERS=	""
38
GALLIUM_DRIVERS=	""
38
.endif
39
.endif
40
VULKAN_DRIVERS=		#
41
39
.if ${ARCH} == amd64 || ${ARCH} == i386 \
42
.if ${ARCH} == amd64 || ${ARCH} == i386 \
40
 || ${ARCH} == powerpc || ${ARCH} == powerpc64
43
 || ${ARCH} == powerpc || ${ARCH} == powerpc64
41
DRI_DRIVERS+=		RADEON R200
44
DRI_DRIVERS+=		RADEON R200
42
GALLIUM_DRIVERS+=	R300 R600
45
GALLIUM_DRIVERS+=	R300 R600
43
. if "${MESA_LLVM_VER}" != ""	# until PPC gets LLVM in base
46
. if "${MESA_LLVM_VER}" != ""	# until PPC gets LLVM in base
44
GALLIUM_DRIVERS+=	RADEONSI
47
GALLIUM_DRIVERS+=	RADEONSI
48
VULKAN_DRIVERS+=	RADEON
45
. endif
49
. endif
46
.endif
50
.endif
47
.if ${ARCH} == amd64 || ${ARCH} == i386
51
.if ${ARCH} == amd64 || ${ARCH} == i386
Lines 50-55 GALLIUM_DRIVERS+= SVGA Link Here
50
. if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100000
54
. if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100000
51
EXTRA_PATCHES+=	${PATCHDIR}/extra-src_mesa_drivers_dri_i965_intel__screen.c
55
EXTRA_PATCHES+=	${PATCHDIR}/extra-src_mesa_drivers_dri_i965_intel__screen.c
52
. endif
56
. endif
57
VULKAN_DRIVERS+=	INTEL
53
.elif ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
58
.elif ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
54
GALLIUM_DRIVERS+=	FREEDRENO VC4
59
GALLIUM_DRIVERS+=	FREEDRENO VC4
55
. if ${ARCH} == armv6 || ${ARCH} == armv7
60
. if ${ARCH} == armv6 || ${ARCH} == armv7
Lines 57-64 EXTRA_PATCHES+= ${PATCHDIR}/extra-src_gallium_drivers_vc4_Makefile.in Link Here
57
. endif
62
. endif
58
.endif
63
.endif
59
64
65
.if ${VULKAN_DRIVERS:MINTEL}
66
BUILD_DEPENDS+=		${PYTHON_PKGNAMEPREFIX}mako>0:textproc/py-mako
67
# --build-id isn't supported by old GNU ld.bfd in base
68
USE_BINUTILS=		yes
69
LDFLAGS+=		-B${LOCALBASE}/bin
70
.endif
71
60
CONFIGURE_ARGS+=	--with-dri-drivers="${DRI_DRIVERS:tl}" \
72
CONFIGURE_ARGS+=	--with-dri-drivers="${DRI_DRIVERS:tl}" \
61
			--with-gallium-drivers="${GALLIUM_DRIVERS:tl}"
73
			--with-gallium-drivers="${GALLIUM_DRIVERS:tl}" \
74
			--with-vulkan-drivers="${VULKAN_DRIVERS:tl}"
62
75
63
.for _d in ${ALL_DRI_DRIVERS}
76
.for _d in ${ALL_DRI_DRIVERS}
64
. if ${DRI_DRIVERS:M${_d}}
77
. if ${DRI_DRIVERS:M${_d}}
Lines 76-81 PLIST_SUB+= ${_gd}_GDRIVER="@comment " Link Here
76
. endif
89
. endif
77
.endfor
90
.endfor
78
91
92
.for _vd in ${ALL_VULKAN_DRIVERS}
93
. if ${VULKAN_DRIVERS:M${_vd}}
94
PLIST_SUB+=	${_vd}_VDRIVER="" ARCH="${ARCH}"
95
. else
96
PLIST_SUB+=	${_vd}_VDRIVER="@comment "
97
. endif
98
.endfor
99
79
.include "${MASTERDIR}/Makefile.targets"
100
.include "${MASTERDIR}/Makefile.targets"
80
101
81
post-install:
102
post-install:
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c (+102 lines)
Added Link Here
1
- Partially implement sys_futex() via _umtx_op()
2
- Partially implement memfd_create() via mkostemp()
3
- Ignore MAP_POPULATE if unsupported
4
5
--- src/intel/vulkan/anv_allocator.c.orig	2017-08-12 16:09:52.000000000 +0000
6
+++ src/intel/vulkan/anv_allocator.c	2017-08-15 09:14:09.658565996 +0000
7
@@ -26,12 +26,31 @@
8
 #include <unistd.h>
9
 #include <limits.h>
10
 #include <assert.h>
11
+#ifdef __linux__
12
 #include <linux/futex.h>
13
 #include <linux/memfd.h>
14
+#endif
15
 #include <sys/time.h>
16
 #include <sys/mman.h>
17
+#ifdef __linux__
18
 #include <sys/syscall.h>
19
+#else
20
+#include <fcntl.h>
21
+#endif
22
 
23
+#ifdef __FreeBSD__
24
+#include <errno.h>
25
+#include <sys/umtx.h>
26
+#endif
27
+
28
+#ifndef MAP_POPULATE
29
+#define MAP_POPULATE 0
30
+#endif
31
+
32
+#ifndef MFD_CLOEXEC
33
+#define MFD_CLOEXEC O_CLOEXEC
34
+#endif
35
+
36
 #include "anv_private.h"
37
 
38
 #include "util/hash_table.h"
39
@@ -112,6 +131,8 @@ struct anv_mmap_cleanup {
40
 
41
 #define ANV_MMAP_CLEANUP_INIT ((struct anv_mmap_cleanup){0})
42
 
43
+#if defined(__linux__)
44
+
45
 static inline long
46
 sys_futex(void *addr1, int op, int val1,
47
           struct timespec *timeout, void *addr2, int val3)
48
@@ -131,11 +152,54 @@ futex_wait(uint32_t *addr, int32_t value)
49
    return sys_futex(addr, FUTEX_WAIT, value, NULL, NULL, 0);
50
 }
51
 
52
+#elif defined(__FreeBSD__)
53
+
54
+/* Based on libxshmfence */
55
+
56
+static inline int
57
+sys_futex(void *addr, int op, int32_t val)
58
+{
59
+   return _umtx_op(addr, op, (uint32_t)val, NULL, NULL) == -1 ? errno : 0;
60
+}
61
+
62
+static inline int
63
+futex_wake(uint32_t *addr, int count)
64
+{
65
+   return sys_futex(addr, UMTX_OP_WAKE, count);
66
+}
67
+
68
+static inline int
69
+futex_wait(uint32_t *addr, int32_t value)
70
+{
71
+   return sys_futex(addr, UMTX_OP_WAIT_UINT, value);
72
+}
73
+#endif
74
+
75
 #ifndef HAVE_MEMFD_CREATE
76
 static inline int
77
 memfd_create(const char *name, unsigned int flags)
78
 {
79
+#ifdef __linux__
80
    return syscall(SYS_memfd_create, name, flags);
81
+#else
82
+   char template[] = "/tmp/shmfd-XXXXXX";
83
+#ifdef HAVE_MKOSTEMP
84
+   int fd = mkostemp(template, flags);
85
+#else
86
+   int fd = mkstemp(template);
87
+   if (flags & O_CLOEXEC) {
88
+     int flags = fcntl(fd, F_GETFD);
89
+     if (flags != -1) {
90
+       flags |= FD_CLOEXEC;
91
+       (void) fcntl(fd, F_SETFD, &flags);
92
+     }
93
+   }
94
+#endif /* HAVE_MKOSTEMP */
95
+   if (fd >= 0)
96
+     unlink(template);
97
+
98
+   return fd;
99
+#endif /* __linux__ */
100
 }
101
 #endif
102
 
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c (+42 lines)
Added Link Here
1
- Without sysinfo() fall back to sysconf()
2
- Define ETIME if missing
3
4
--- src/intel/vulkan/anv_device.c.orig	2017-08-12 16:09:52 UTC
5
+++ src/intel/vulkan/anv_device.c
6
@@ -25,7 +25,9 @@
7
 #include <stdbool.h>
8
 #include <string.h>
9
 #include <sys/mman.h>
10
+#ifdef __GLIBC__
11
 #include <sys/sysinfo.h>
12
+#endif
13
 #include <unistd.h>
14
 #include <fcntl.h>
15
 #include <xf86drm.h>
16
@@ -39,6 +41,10 @@
17
 
18
 #include "genxml/gen7_pack.h"
19
 
20
+#ifndef ETIME
21
+#define ETIME ETIMEDOUT
22
+#endif
23
+
24
 static void
25
 compiler_debug_log(void *data, const char *fmt, ...)
26
 { }
27
@@ -73,10 +79,15 @@ anv_compute_heap_size(int fd, uint64_t *heap_size)
28
    }
29
 
30
    /* Query the total ram from the system */
31
+#ifdef __GLIBC__
32
    struct sysinfo info;
33
    sysinfo(&info);
34
 
35
    uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit;
36
+#else
37
+   uint64_t total_ram = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE);
38
+#endif
39
+
40
 
41
    /* We don't want to burn too much ram with the GPU.  If the user has 4GiB
42
     * or less, we use at most half.  If they have more than 4GiB, we use 3/4.
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c (+14 lines)
Added Link Here
1
- Define ETIME if missing
2
3
--- src/intel/vulkan/anv_gem.c.orig	2017-10-23 13:21:18 UTC
4
+++ src/intel/vulkan/anv_gem.c
5
@@ -26,6 +26,9 @@
6
 #include <sys/mman.h>
7
 #include <string.h>
8
 #include <errno.h>
9
+#ifndef ETIME
10
+#define ETIME ETIMEDOUT
11
+#endif
12
 #include <unistd.h>
13
 #include <fcntl.h>
14
 
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c (+18 lines)
Added Link Here
1
- Define ETIME if missing
2
- Drop header that was never used
3
4
--- src/intel/vulkan/anv_queue.c.orig	2017-10-23 13:21:18 UTC
5
+++ src/intel/vulkan/anv_queue.c
6
@@ -26,8 +26,11 @@
7
  */
8
 
9
 #include <fcntl.h>
10
+#include <errno.h>
11
+#ifndef ETIME
12
+#define ETIME ETIMEDOUT
13
+#endif
14
 #include <unistd.h>
15
-#include <sys/eventfd.h>
16
 
17
 #include "anv_private.h"
18
 #include "vk_util.h"
(-)b/graphics/mesa-dri/pkg-plist (+5 lines)
Lines 23-28 include/GL/internal/dri_interface.h Link Here
23
@comment include/GLES3/gl3platform.h
23
@comment include/GLES3/gl3platform.h
24
@comment include/KHR/khrplatform.h
24
@comment include/KHR/khrplatform.h
25
@comment include/gbm.h
25
@comment include/gbm.h
26
%%INTEL_VDRIVER%%include/vulkan/vulkan_intel.h
26
%%I915_DRIVER%%lib/dri/i915_dri.so
27
%%I915_DRIVER%%lib/dri/i915_dri.so
27
%%I965_DRIVER%%lib/dri/i965_dri.so
28
%%I965_DRIVER%%lib/dri/i965_dri.so
28
%%FREEDRENO_GDRIVER%%lib/dri/kgsl_dri.so
29
%%FREEDRENO_GDRIVER%%lib/dri/kgsl_dri.so
Lines 80-85 include/GL/internal/dri_interface.h Link Here
80
%%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1
81
%%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1
81
%%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1.0
82
%%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1.0
82
%%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1.0.0
83
%%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1.0.0
84
%%INTEL_VDRIVER%%lib/libvulkan_intel.so
85
%%RADEON_VDRIVER%%lib/libvulkan_radeon.so
83
@comment lib/libwayland-egl.so
86
@comment lib/libwayland-egl.so
84
@comment lib/libwayland-egl.so.1
87
@comment lib/libwayland-egl.so.1
85
@comment lib/libwayland-egl.so.1.0.0
88
@comment lib/libwayland-egl.so.1.0.0
Lines 90-92 libdata/pkgconfig/dri.pc Link Here
90
@comment libdata/pkgconfig/glesv2.pc
93
@comment libdata/pkgconfig/glesv2.pc
91
@comment libdata/pkgconfig/osmesa.pc
94
@comment libdata/pkgconfig/osmesa.pc
92
@comment libdata/pkgconfig/wayland-egl.pc
95
@comment libdata/pkgconfig/wayland-egl.pc
96
%%INTEL_VDRIVER%%share/vulkan/icd.d/intel_icd.%%ARCH%%.json
97
%%RADEON_VDRIVER%%share/vulkan/icd.d/radeon_icd.%%ARCH%%.json

Return to bug 221540