FreeBSD Bugzilla – Attachment 188519 Details for
Bug 221540
graphics/mesa-dri: enable Vulkan drivers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Part 1 (Mesa 17.3) - Build anv and radv
mesa-vulkan-17.3.diff (text/plain), 9.53 KB, created by
Jan Beich
on 2017-12-04 12:53:12 UTC
(
hide
)
Description:
Part 1 (Mesa 17.3) - Build anv and radv
Filename:
MIME Type:
Creator:
Jan Beich
Created:
2017-12-04 12:53:12 UTC
Size:
9.53 KB
patch
obsolete
>From 10c680354ad125d7bcb27e1b81c3020a2157b7c4 Mon Sep 17 00:00:00 2001 >From: Jan Beich <jbeich@FreeBSD.org> >Date: Tue, 15 Aug 2017 11:16:07 +0000 >Subject: [PATCH] graphics/mesa-dri: enable Vulkan drivers > >PR: 221540 >Approved by: x11 (???) or maintainer timeout (1 month) >--- > graphics/mesa-dri/Makefile | 23 ++++- > .../files/patch-src_intel_vulkan_anv__allocator.c | 102 +++++++++++++++++++++ > .../files/patch-src_intel_vulkan_anv__device.c | 42 +++++++++ > .../files/patch-src_intel_vulkan_anv__gem.c | 14 +++ > .../files/patch-src_intel_vulkan_anv__queue.c | 18 ++++ > graphics/mesa-dri/pkg-plist | 5 + > 6 files changed, 203 insertions(+), 1 deletion(-) > create mode 100644 graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c > create mode 100644 graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c > create mode 100644 graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c > create mode 100644 graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c > >diff --git a/graphics/mesa-dri/Makefile b/graphics/mesa-dri/Makefile >index ffafbbe424ab..d1802909ac09 100644 >--- a/graphics/mesa-dri/Makefile >+++ b/graphics/mesa-dri/Makefile >@@ -29,6 +29,7 @@ VDPAU_LIB_DEPENDS= libvdpau.so:multimedia/libvdpau > > ALL_DRI_DRIVERS= I915 I965 RADEON R200 SWRAST > ALL_GALLIUM_DRIVERS= FREEDRENO R300 R600 RADEONSI SVGA SWRAST VC4 >+ALL_VULKAN_DRIVERS= INTEL RADEON > > DRI_DRIVERS= SWRAST # classic swrast > .if "${MESA_LLVM_VER}" != "" >@@ -36,12 +37,15 @@ GALLIUM_DRIVERS= SWRAST # llvmpipe > .else > GALLIUM_DRIVERS= "" > .endif >+VULKAN_DRIVERS= # >+ > .if ${ARCH} == amd64 || ${ARCH} == i386 \ > || ${ARCH} == powerpc || ${ARCH} == powerpc64 > DRI_DRIVERS+= RADEON R200 > GALLIUM_DRIVERS+= R300 R600 > . if "${MESA_LLVM_VER}" != "" # until PPC gets LLVM in base > GALLIUM_DRIVERS+= RADEONSI >+VULKAN_DRIVERS+= RADEON > . endif > .endif > .if ${ARCH} == amd64 || ${ARCH} == i386 >@@ -50,6 +54,7 @@ GALLIUM_DRIVERS+= SVGA > . if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100000 > EXTRA_PATCHES+= ${PATCHDIR}/extra-src_mesa_drivers_dri_i965_intel__screen.c > . endif >+VULKAN_DRIVERS+= INTEL > .elif ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7 > GALLIUM_DRIVERS+= FREEDRENO VC4 > . if ${ARCH} == armv6 || ${ARCH} == armv7 >@@ -57,8 +62,16 @@ EXTRA_PATCHES+= ${PATCHDIR}/extra-src_gallium_drivers_vc4_Makefile.in > . endif > .endif > >+.if ${VULKAN_DRIVERS:MINTEL} >+BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}mako>0:textproc/py-mako >+# --build-id isn't supported by old GNU ld.bfd in base >+USE_BINUTILS= yes >+LDFLAGS+= -B${LOCALBASE}/bin >+.endif >+ > CONFIGURE_ARGS+= --with-dri-drivers="${DRI_DRIVERS:tl}" \ >- --with-gallium-drivers="${GALLIUM_DRIVERS:tl}" >+ --with-gallium-drivers="${GALLIUM_DRIVERS:tl}" \ >+ --with-vulkan-drivers="${VULKAN_DRIVERS:tl}" > > .for _d in ${ALL_DRI_DRIVERS} > . if ${DRI_DRIVERS:M${_d}} >@@ -76,6 +89,14 @@ PLIST_SUB+= ${_gd}_GDRIVER="@comment " > . endif > .endfor > >+.for _vd in ${ALL_VULKAN_DRIVERS} >+. if ${VULKAN_DRIVERS:M${_vd}} >+PLIST_SUB+= ${_vd}_VDRIVER="" ARCH="${ARCH}" >+. else >+PLIST_SUB+= ${_vd}_VDRIVER="@comment " >+. endif >+.endfor >+ > .include "${MASTERDIR}/Makefile.targets" > > post-install: >diff --git a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c >new file mode 100644 >index 000000000000..9f98b40cf498 >--- /dev/null >+++ b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c >@@ -0,0 +1,102 @@ >+- Partially implement sys_futex() via _umtx_op() >+- Partially implement memfd_create() via mkostemp() >+- Ignore MAP_POPULATE if unsupported >+ >+--- src/intel/vulkan/anv_allocator.c.orig 2017-08-12 16:09:52.000000000 +0000 >++++ src/intel/vulkan/anv_allocator.c 2017-08-15 09:14:09.658565996 +0000 >+@@ -26,12 +26,31 @@ >+ #include <unistd.h> >+ #include <limits.h> >+ #include <assert.h> >++#ifdef __linux__ >+ #include <linux/futex.h> >+ #include <linux/memfd.h> >++#endif >+ #include <sys/time.h> >+ #include <sys/mman.h> >++#ifdef __linux__ >+ #include <sys/syscall.h> >++#else >++#include <fcntl.h> >++#endif >+ >++#ifdef __FreeBSD__ >++#include <errno.h> >++#include <sys/umtx.h> >++#endif >++ >++#ifndef MAP_POPULATE >++#define MAP_POPULATE 0 >++#endif >++ >++#ifndef MFD_CLOEXEC >++#define MFD_CLOEXEC O_CLOEXEC >++#endif >++ >+ #include "anv_private.h" >+ >+ #include "util/hash_table.h" >+@@ -112,6 +131,8 @@ struct anv_mmap_cleanup { >+ >+ #define ANV_MMAP_CLEANUP_INIT ((struct anv_mmap_cleanup){0}) >+ >++#if defined(__linux__) >++ >+ static inline long >+ sys_futex(void *addr1, int op, int val1, >+ struct timespec *timeout, void *addr2, int val3) >+@@ -131,11 +152,54 @@ futex_wait(uint32_t *addr, int32_t value) >+ return sys_futex(addr, FUTEX_WAIT, value, NULL, NULL, 0); >+ } >+ >++#elif defined(__FreeBSD__) >++ >++/* Based on libxshmfence */ >++ >++static inline int >++sys_futex(void *addr, int op, int32_t val) >++{ >++ return _umtx_op(addr, op, (uint32_t)val, NULL, NULL) == -1 ? errno : 0; >++} >++ >++static inline int >++futex_wake(uint32_t *addr, int count) >++{ >++ return sys_futex(addr, UMTX_OP_WAKE, count); >++} >++ >++static inline int >++futex_wait(uint32_t *addr, int32_t value) >++{ >++ return sys_futex(addr, UMTX_OP_WAIT_UINT, value); >++} >++#endif >++ >+ #ifndef HAVE_MEMFD_CREATE >+ static inline int >+ memfd_create(const char *name, unsigned int flags) >+ { >++#ifdef __linux__ >+ return syscall(SYS_memfd_create, name, flags); >++#else >++ char template[] = "/tmp/shmfd-XXXXXX"; >++#ifdef HAVE_MKOSTEMP >++ int fd = mkostemp(template, flags); >++#else >++ int fd = mkstemp(template); >++ if (flags & O_CLOEXEC) { >++ int flags = fcntl(fd, F_GETFD); >++ if (flags != -1) { >++ flags |= FD_CLOEXEC; >++ (void) fcntl(fd, F_SETFD, &flags); >++ } >++ } >++#endif /* HAVE_MKOSTEMP */ >++ if (fd >= 0) >++ unlink(template); >++ >++ return fd; >++#endif /* __linux__ */ >+ } >+ #endif >+ >diff --git a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c >new file mode 100644 >index 000000000000..554c26333ef1 >--- /dev/null >+++ b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c >@@ -0,0 +1,42 @@ >+- Without sysinfo() fall back to sysconf() >+- Define ETIME if missing >+ >+--- src/intel/vulkan/anv_device.c.orig 2017-08-12 16:09:52 UTC >++++ src/intel/vulkan/anv_device.c >+@@ -25,7 +25,9 @@ >+ #include <stdbool.h> >+ #include <string.h> >+ #include <sys/mman.h> >++#ifdef __GLIBC__ >+ #include <sys/sysinfo.h> >++#endif >+ #include <unistd.h> >+ #include <fcntl.h> >+ #include <xf86drm.h> >+@@ -39,6 +41,10 @@ >+ >+ #include "genxml/gen7_pack.h" >+ >++#ifndef ETIME >++#define ETIME ETIMEDOUT >++#endif >++ >+ static void >+ compiler_debug_log(void *data, const char *fmt, ...) >+ { } >+@@ -73,10 +79,15 @@ anv_compute_heap_size(int fd, uint64_t *heap_size) >+ } >+ >+ /* Query the total ram from the system */ >++#ifdef __GLIBC__ >+ struct sysinfo info; >+ sysinfo(&info); >+ >+ uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit; >++#else >++ uint64_t total_ram = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE); >++#endif >++ >+ >+ /* We don't want to burn too much ram with the GPU. If the user has 4GiB >+ * or less, we use at most half. If they have more than 4GiB, we use 3/4. >diff --git a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c >new file mode 100644 >index 000000000000..82a56ce065d4 >--- /dev/null >+++ b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c >@@ -0,0 +1,14 @@ >+- Define ETIME if missing >+ >+--- src/intel/vulkan/anv_gem.c.orig 2017-10-23 13:21:18 UTC >++++ src/intel/vulkan/anv_gem.c >+@@ -26,6 +26,9 @@ >+ #include <sys/mman.h> >+ #include <string.h> >+ #include <errno.h> >++#ifndef ETIME >++#define ETIME ETIMEDOUT >++#endif >+ #include <unistd.h> >+ #include <fcntl.h> >+ >diff --git a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c >new file mode 100644 >index 000000000000..92cabb2375f0 >--- /dev/null >+++ b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c >@@ -0,0 +1,18 @@ >+- Define ETIME if missing >+- Drop header that was never used >+ >+--- src/intel/vulkan/anv_queue.c.orig 2017-10-23 13:21:18 UTC >++++ src/intel/vulkan/anv_queue.c >+@@ -26,8 +26,11 @@ >+ */ >+ >+ #include <fcntl.h> >++#include <errno.h> >++#ifndef ETIME >++#define ETIME ETIMEDOUT >++#endif >+ #include <unistd.h> >+-#include <sys/eventfd.h> >+ >+ #include "anv_private.h" >+ #include "vk_util.h" >diff --git a/graphics/mesa-dri/pkg-plist b/graphics/mesa-dri/pkg-plist >index 94540355c457..96b9268b3104 100644 >--- a/graphics/mesa-dri/pkg-plist >+++ b/graphics/mesa-dri/pkg-plist >@@ -23,6 +23,7 @@ include/GL/internal/dri_interface.h > @comment include/GLES3/gl3platform.h > @comment include/KHR/khrplatform.h > @comment include/gbm.h >+%%INTEL_VDRIVER%%include/vulkan/vulkan_intel.h > %%I915_DRIVER%%lib/dri/i915_dri.so > %%I965_DRIVER%%lib/dri/i965_dri.so > %%FREEDRENO_GDRIVER%%lib/dri/kgsl_dri.so >@@ -80,6 +81,8 @@ include/GL/internal/dri_interface.h > %%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1 > %%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1.0 > %%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so.1.0.0 >+%%INTEL_VDRIVER%%lib/libvulkan_intel.so >+%%RADEON_VDRIVER%%lib/libvulkan_radeon.so > @comment lib/libwayland-egl.so > @comment lib/libwayland-egl.so.1 > @comment lib/libwayland-egl.so.1.0.0 >@@ -90,3 +93,5 @@ libdata/pkgconfig/dri.pc > @comment libdata/pkgconfig/glesv2.pc > @comment libdata/pkgconfig/osmesa.pc > @comment libdata/pkgconfig/wayland-egl.pc >+%%INTEL_VDRIVER%%share/vulkan/icd.d/intel_icd.%%ARCH%%.json >+%%RADEON_VDRIVER%%share/vulkan/icd.d/radeon_icd.%%ARCH%%.json
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 221540
:
185445
|
186578
|
186579
|
186610
|
187400
|
187401
|
187404
|
188519
|
188635
|
188666
|
188667
|
189177