Index: head/graphics/mesa-dri/Makefile =================================================================== --- head/graphics/mesa-dri/Makefile (revision 457429) +++ head/graphics/mesa-dri/Makefile (revision 457430) @@ -1,84 +1,108 @@ # Created by: Eric Anholt # $FreeBSD$ PORTNAME= mesa-dri PORTVERSION= ${MESAVERSION} +PORTREVISION= 1 CATEGORIES= graphics COMMENT= OpenGL hardware acceleration drivers for DRI2+ USE_XORG= dri2proto dri3proto glproto presentproto x11 xdamage xext \ xfixes xshmfence xv xvmc OPTIONS_DEFINE= TEXTURE VAAPI VDPAU OPTIONS_DEFAULT=TEXTURE OPTIONS_SUB= yes TEXTURE_DESC= Enable texture-float support (patent encumbered) TEXTURE_CONFIGURE_ENABLE= texture-float VAAPI_CONFIGURE_ENABLE= va VAAPI_LIB_DEPENDS= libva.so:multimedia/libva VAAPI_USE= XORG=xcb VDPAU_CONFIGURE_ENABLE= vdpau VDPAU_LIB_DEPENDS= libvdpau.so:multimedia/libvdpau .include .include "${.CURDIR:H:H}/graphics/mesa-dri/Makefile.common" 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}" != "" 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 DRI_DRIVERS+= I915 I965 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 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@${PY_FLAVOR} +. if ${/usr/bin/ld:L:tA} != "/usr/bin/ld.lld" +# --build-id isn't supported by old GNU ld.bfd in base +USE_BINUTILS= yes +LDFLAGS+= -B${LOCALBASE}/bin +. endif +.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}} PLIST_SUB+= ${_d}_DRIVER="" . else PLIST_SUB+= ${_d}_DRIVER="@comment " . endif .endfor .for _gd in ${ALL_GALLIUM_DRIVERS} . if ${GALLIUM_DRIVERS:M${_gd}} PLIST_SUB+= ${_gd}_GDRIVER="" . else 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: @${RM} -r ${STAGEDIR}/etc/OpenCL .include Index: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c =================================================================== --- head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c (nonexistent) +++ head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c (revision 457430) @@ -0,0 +1,104 @@ +- 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 UTC ++++ src/intel/vulkan/anv_allocator.c +@@ -26,12 +26,31 @@ + #include + #include + #include ++#ifdef __linux__ + #include + #include ++#endif + #include + #include ++#ifdef __linux__ + #include ++#else ++#include ++#endif + ++#ifdef __FreeBSD__ ++#include ++#include ++#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,56 @@ 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) + { ++#if defined(__linux__) + return syscall(SYS_memfd_create, name, flags); ++#elif defined(__FreeBSD__) ++ return shm_open(SHM_ANON, flags | O_RDWR | O_CREAT, 0600); ++#else /* DragonFly, NetBSD, OpenBSD, Solaris */ ++ 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 + Property changes on: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c =================================================================== --- head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c (nonexistent) +++ head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c (revision 457430) @@ -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 + #include + #include ++#ifdef __GLIBC__ + #include ++#endif + #include + #include + #include +@@ -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. Property changes on: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c =================================================================== --- head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c (nonexistent) +++ head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c (revision 457430) @@ -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 + #include + #include ++#ifndef ETIME ++#define ETIME ETIMEDOUT ++#endif + #include + #include + Property changes on: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c =================================================================== --- head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c (nonexistent) +++ head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c (revision 457430) @@ -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 ++#include ++#ifndef ETIME ++#define ETIME ETIMEDOUT ++#endif + #include +-#include + + #include "anv_private.h" + #include "vk_util.h" Property changes on: head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/graphics/mesa-dri/pkg-plist =================================================================== --- head/graphics/mesa-dri/pkg-plist (revision 457429) +++ head/graphics/mesa-dri/pkg-plist (revision 457430) @@ -1,92 +1,97 @@ etc/drirc @comment include/EGL/egl.h @comment include/EGL/eglext.h @comment include/EGL/eglextchromium.h @comment include/EGL/eglmesaext.h @comment include/EGL/eglplatform.h @comment include/GL/gl.h @comment include/GL/gl_mangle.h @comment include/GL/glcorearb.h @comment include/GL/glext.h @comment include/GL/glx.h @comment include/GL/glx_mangle.h @comment include/GL/glxext.h include/GL/internal/dri_interface.h @comment include/GL/osmesa.h @comment include/GLES2/gl2.h @comment include/GLES2/gl2ext.h @comment include/GLES2/gl2platform.h @comment include/GLES3/gl3.h @comment include/GLES3/gl31.h @comment include/GLES3/gl32.h @comment include/GLES3/gl3ext.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 %%SWRAST_GDRIVER%%lib/dri/kms_swrast_dri.so %%FREEDRENO_GDRIVER%%lib/dri/msm_dri.so %%R200_DRIVER%%lib/dri/r200_dri.so %%R300_GDRIVER%%lib/dri/r300_dri.so %%R600_GDRIVER%%lib/dri/r600_dri.so %%VAAPI%%%%R600_GDRIVER%%lib/dri/r600_drv_video.so %%RADEON_DRIVER%%lib/dri/radeon_dri.so %%RADEONSI_GDRIVER%%lib/dri/radeonsi_dri.so %%VAAPI%%%%RADEONSI_GDRIVER%%lib/dri/radeonsi_drv_video.so %%SWRAST_DRIVER%%lib/dri/swrast_dri.so %%VC4_GDRIVER%%lib/dri/vc4_dri.so %%SVGA_GDRIVER%%lib/dri/vmwgfx_dri.so @comment lib/gallium-pipe/pipe_r300.so @comment lib/gallium-pipe/pipe_r600.so @comment lib/gallium-pipe/pipe_radeonsi.so @comment lib/gallium-pipe/pipe_swrast.so @comment lib/gallium-pipe/pipe_vmwgfx.so @comment lib/libEGL.so @comment lib/libEGL.so.1 @comment lib/libEGL.so.1.0.0 @comment lib/libGL.so @comment lib/libGL.so.1 @comment lib/libGL.so.1.2.0 @comment lib/libGLESv2.so @comment lib/libGLESv2.so.2 @comment lib/libGLESv2.so.2.0.0 @comment lib/libMesaOpenCL.so @comment lib/libMesaOpenCL.so.1 @comment lib/libMesaOpenCL.so.1.0.0 @comment lib/libOSMesa.so @comment lib/libOSMesa.so.8 @comment lib/libOSMesa.so.8.0.0 %%R600_GDRIVER%%lib/libXvMCr600.so %%R600_GDRIVER%%lib/libXvMCr600.so.1 %%R600_GDRIVER%%lib/libXvMCr600.so.1.0 %%R600_GDRIVER%%lib/libXvMCr600.so.1.0.0 @comment lib/libgbm.so @comment lib/libgbm.so.1 @comment lib/libgbm.so.1.0.0 @comment lib/libglapi.so @comment lib/libglapi.so.0 @comment lib/libglapi.so.0.0.0 %%VDPAU%%%%R300_GDRIVER%%lib/vdpau/libvdpau_r300.so %%VDPAU%%%%R300_GDRIVER%%lib/vdpau/libvdpau_r300.so.1 %%VDPAU%%%%R300_GDRIVER%%lib/vdpau/libvdpau_r300.so.1.0 %%VDPAU%%%%R300_GDRIVER%%lib/vdpau/libvdpau_r300.so.1.0.0 %%VDPAU%%%%R600_GDRIVER%%lib/vdpau/libvdpau_r600.so %%VDPAU%%%%R600_GDRIVER%%lib/vdpau/libvdpau_r600.so.1 %%VDPAU%%%%R600_GDRIVER%%lib/vdpau/libvdpau_r600.so.1.0 %%VDPAU%%%%R600_GDRIVER%%lib/vdpau/libvdpau_r600.so.1.0.0 %%VDPAU%%%%RADEONSI_GDRIVER%%lib/vdpau/libvdpau_radeonsi.so %%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 libdata/pkgconfig/dri.pc @comment libdata/pkgconfig/egl.pc @comment libdata/pkgconfig/gbm.pc @comment libdata/pkgconfig/gl.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