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 31-36 VDPAU_LIB_DEPENDS= libvdpau.so:multimedia/libvdpau Link Here
31
31
32
ALL_DRI_DRIVERS=	I915 I965 RADEON R200 SWRAST
32
ALL_DRI_DRIVERS=	I915 I965 RADEON R200 SWRAST
33
ALL_GALLIUM_DRIVERS=	FREEDRENO R300 R600 RADEONSI SVGA SWRAST VC4
33
ALL_GALLIUM_DRIVERS=	FREEDRENO R300 R600 RADEONSI SVGA SWRAST VC4
34
ALL_VULKAN_DRIVERS=	INTEL RADEON
34
35
35
DRI_DRIVERS=		SWRAST	# classic swrast
36
DRI_DRIVERS=		SWRAST	# classic swrast
36
.if "${MESA_LLVM_VER}" != ""
37
.if "${MESA_LLVM_VER}" != ""
Lines 38-49 GALLIUM_DRIVERS= SWRAST # llvmpipe Link Here
38
.else
39
.else
39
GALLIUM_DRIVERS=	""
40
GALLIUM_DRIVERS=	""
40
.endif
41
.endif
42
VULKAN_DRIVERS=		#
43
41
.if ${ARCH} == amd64 || ${ARCH} == i386 \
44
.if ${ARCH} == amd64 || ${ARCH} == i386 \
42
 || ${ARCH} == powerpc || ${ARCH} == powerpc64
45
 || ${ARCH} == powerpc || ${ARCH} == powerpc64
43
DRI_DRIVERS+=		RADEON R200
46
DRI_DRIVERS+=		RADEON R200
44
GALLIUM_DRIVERS+=	R300 R600
47
GALLIUM_DRIVERS+=	R300 R600
45
. if "${MESA_LLVM_VER}" != ""	# until PPC gets LLVM in base
48
. if "${MESA_LLVM_VER}" != ""	# until PPC gets LLVM in base
46
GALLIUM_DRIVERS+=	RADEONSI
49
GALLIUM_DRIVERS+=	RADEONSI
50
VULKAN_DRIVERS+=	RADEON
47
. endif
51
. endif
48
.endif
52
.endif
49
.if ${ARCH} == amd64 || ${ARCH} == i386
53
.if ${ARCH} == amd64 || ${ARCH} == i386
Lines 52-57 GALLIUM_DRIVERS+= SVGA Link Here
52
. if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100000
56
. if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100000
53
EXTRA_PATCHES+=	${PATCHDIR}/extra-src_mesa_drivers_dri_i965_intel__screen.c
57
EXTRA_PATCHES+=	${PATCHDIR}/extra-src_mesa_drivers_dri_i965_intel__screen.c
54
. endif
58
. endif
59
VULKAN_DRIVERS+=	INTEL
55
.elif ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
60
.elif ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
56
GALLIUM_DRIVERS+=	FREEDRENO VC4
61
GALLIUM_DRIVERS+=	FREEDRENO VC4
57
. if ${ARCH} == armv6 || ${ARCH} == armv7
62
. if ${ARCH} == armv6 || ${ARCH} == armv7
Lines 59-66 EXTRA_PATCHES+= ${PATCHDIR}/extra-src_gallium_drivers_vc4_Makefile.in Link Here
59
. endif
64
. endif
60
.endif
65
.endif
61
66
67
.if ${VULKAN_DRIVERS:MINTEL}
68
BUILD_DEPENDS+=		${PYTHON_PKGNAMEPREFIX}mako>0:textproc/py-mako
69
# --build-id isn't supported by old GNU ld.bfd in base
70
USE_BINUTILS=		yes
71
LDFLAGS+=		-B${LOCALBASE}/bin
72
.endif
73
62
CONFIGURE_ARGS+=	--with-dri-drivers="${DRI_DRIVERS:tl}" \
74
CONFIGURE_ARGS+=	--with-dri-drivers="${DRI_DRIVERS:tl}" \
63
			--with-gallium-drivers="${GALLIUM_DRIVERS:tl}"
75
			--with-gallium-drivers="${GALLIUM_DRIVERS:tl}" \
76
			--with-vulkan-drivers="${VULKAN_DRIVERS:tl}"
64
77
65
.for _d in ${ALL_DRI_DRIVERS}
78
.for _d in ${ALL_DRI_DRIVERS}
66
. if ${DRI_DRIVERS:M${_d}}
79
. if ${DRI_DRIVERS:M${_d}}
Lines 78-83 PLIST_SUB+= ${_gd}_GDRIVER="@comment " Link Here
78
. endif
91
. endif
79
.endfor
92
.endfor
80
93
94
.for _vd in ${ALL_VULKAN_DRIVERS}
95
. if ${VULKAN_DRIVERS:M${_vd}}
96
PLIST_SUB+=	${_vd}_VDRIVER="" ARCH="${ARCH}"
97
. else
98
PLIST_SUB+=	${_vd}_VDRIVER="@comment "
99
. endif
100
.endfor
101
81
.include "${MASTERDIR}/Makefile.targets"
102
.include "${MASTERDIR}/Makefile.targets"
82
103
83
post-install:
104
post-install:
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c (+101 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,10 +152,53 @@ 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
+static inline int
76
 memfd_create(const char *name, unsigned int flags)
77
 {
78
+#ifdef __linux__
79
    return syscall(SYS_memfd_create, name, flags);
80
+#else
81
+   char template[] = "/tmp/shmfd-XXXXXX";
82
+#ifdef HAVE_MKOSTEMP
83
+   int fd = mkostemp(template, flags);
84
+#else
85
+   int fd = mkstemp(template);
86
+   if (flags & O_CLOEXEC) {
87
+     int flags = fcntl(fd, F_GETFD);
88
+     if (flags != -1) {
89
+       flags |= FD_CLOEXEC;
90
+       (void) fcntl(fd, F_SETFD, &flags);
91
+     }
92
+   }
93
+#endif /* HAVE_MKOSTEMP */
94
+   if (fd >= 0)
95
+     unlink(template);
96
+
97
+   return fd;
98
+#endif /* __linux__ */
99
 }
100
 
101
 static inline uint32_t
(-)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