1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Mesa 3D Graphics Library
8 HOMEPAGE= https://www.mesa3d.org/
12 SITES[main]= https://mesa.freedesktop.org/archive/
13 ftp://ftp.freedesktop.org/pub/mesa/
14 DISTFILE[1]= mesa-18.1.4.tar.xz:main
16 SPKGS[standard]= complete
22 OPTIONS_AVAILABLE= X86_DRIVERS ARM_DRIVERS
23 OPTIONS_STANDARD= X86_DRIVERS ARM_DRIVERS
24 OPT_ON[aarch64]= ARM_DRIVERS
25 OPT_ON[x86_64]= X86_DRIVERS
26 OPT_ON[i386]= X86_DRIVERS
28 BUILD_DEPENDS= libpthread-stubs:single:standard
29 libclc:single:standard
32 zlib:complete:standard
33 libelf:single:standard
34 libvdpau:single:standard
37 BUILDRUN_DEPENDS= expat:shared:standard
38 libdrm:single:standard
39 ocl-icd:primary:standard
40 opencl:single:standard
41 B_DEPS[sunos]= libbsd4sol:single:standard
42 EXRUN[clover]= llvm40:llvm:standard
44 libelf:single:standard
46 libdrm:single:standard
47 EXRUN[drivers]= llvm40:llvm:standard
50 libelf:single:standard
51 EXRUN[osmesa]= llvm40:llvm:standard
55 USES= bison gettext-tools gmake libtool pkgconfig
56 python:py27,build shebangfix
57 c++:clover,drivers,osmesa
58 XORG_COMPONENTS= x11 xcb xdamage xext xfixes xshmfence xxf86vm xv
61 LICENSE= MIT:libs CUSTOM1:libs CUSTOM2:libs
62 LICENSE_NAME= CUSTOM1:"Kronos License (MIT with modifications)"
63 CUSTOM2:"SGI Free Software License B"
64 LICENSE_FILE= MIT:{{WRKDIR}}/LICENSE_MIT
65 CUSTOM1:{{WRKDIR}}/LICENSE_KHRONOS
66 CUSTOM2:{{WRKDIR}}/LICENSE_SGI
67 LICENSE_AWK= MIT:"^$$"
69 LICENSE_SOURCE= MIT:{{WRKSRC}}/include/GL/gl.h
70 CUSTOM2:{{WRKSRC}}/src/glx/eval.c
73 FPC_EQUIVALENT= graphics/mesa-libs
74 SHEBANG_FILES= src/gallium/*/*/*.py
75 src/gallium/tools/trace/*.py
76 src/gallium/drivers/svga/svgadump/svga_dump.py
77 src/mapi/glapi/gen/*.py
79 src/util/xmlpool/gen_xmlpool.py
80 src/mesa/main/get_*.py
81 src/util/format_srgb.py
83 src/intel/genxml/gen_pack_header.py
84 SHEBANG_OLD_PYTHON= /usr/bin/env[[:space:]]python2
86 /bin/env[[:space:]]python
89 CONFIGURE_ARGS= --enable-llvm
90 --enable-texture-float
97 --with-platforms=x11,drm
98 --enable-gallium-osmesa
99 --with-llvm-prefix={{LOCALBASE}}/llvm40
100 --with-dri-drivers="{{DRI_DRIVERS:tl}}"
101 --with-gallium_drivers="{{GALLIUM_DRIVERS:tl}}"
102 CONFIGURE_ENV= ax_cv_check_cflags___Wno_initializer_overrides=no
104 INSTALL_TARGET= install-strip
105 INSTALL_REQ_TOOLCHAIN= yes
107 LDFLAGS= -Wl,-rpath,{{LOCALBASE}}/llvm40/lib
108 VAR_OPSYS[sunos]= CPPFLAGS=-D__EXTENSIONS__=1
109 CPPFLAGS=-D_POSIX_PTHREAD_SEMANTICS
110 CFLAGS=-DF_DUPFD_CLOEXEC=F_DUPFD
112 [ARM_DRIVERS].DESCRIPTION= Build drivers for aarch64 architecture
113 [ARM_DRIVERS].MAKEFILE_ON= GALLIUM_DRIVERS+=FREEDRENO
116 [X86_DRIVERS].DESCRIPTION= Build drivers for i386 and x86_64 architectures
117 [X86_DRIVERS].CONFIGURE_ENABLE_BOTH= opencl
119 [X86_DRIVERS].MAKEFILE_ON= DRI_DRIVERS+=RADEON
123 GALLIUM_DRIVERS+=R300
124 GALLIUM_DRIVERS+=R600
125 GALLIUM_DRIVERS+=RADEONSI
126 GALLIUM_DRIVERS+=SVGA
129 ${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' \
130 ${WRKSRC}/src/util/xmlconfig.c
131 # Use --link-static until ports/223191 is fixed
132 ${REINPLACE_CMD} -e '/$$LLVM_VERSION_MAJOR -ge 4/s|test |false |' \
136 ${AWK} '/Copyright/,/DEALINGS/' ${WRKSRC}/include/GL/glext.h \
137 > ${WRKDIR}/LICENSE_KHRONOS
140 ${REINPLACE_CMD} -e 's|x86_64|amd64|' ${WRKSRC}/configure
144 -e '/^CFLAGS =/ s|$$| -I$$(prefix)/include/bsd|' \
145 -e '/^LDFLAGS =/ s|$$| -lbsd|' \
146 ${WRKSRC}/src/egl/Makefile.in \
147 ${WRKSRC}/src/gallium/drivers/r600/Makefile.in \
148 ${WRKSRC}/src/gallium/drivers/radeon/Makefile.in \
149 ${WRKSRC}/src/gallium/drivers/radeonsi/Makefile.in \
150 ${WRKSRC}/src/gallium/auxiliary/Makefile.in \
151 ${WRKSRC}/src/loader/Makefile.in
153 [FILE:808:descriptions/desc.libs]
154 The Mesa project began as an open-source implementation of the OpenGL
155 specification - a system for rendering interactive 3D graphics.
157 Over the years the project has grown to implement more graphics APIs,
158 including OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API,
161 A variety of device drivers allows the Mesa libraries to be used in many
162 different environments ranging from software emulation to complete
163 hardware acceleration for modern GPUs.
165 Mesa ties into several other open-source projects: the Direct Rendering
166 Infrastructure and X.org to provide OpenGL support on Linux, FreeBSD
167 and other operating systems.
169 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
170 These include libEGL, libGL, and libglesv2 as well as utlity libraries
174 [FILE:130:descriptions/desc.clover]
175 This package contains Mesa's libOpenCL implementation "Clover".
176 It is built upon GALLIUM and currently only supports Radeon GPUs.
179 [FILE:162:descriptions/desc.drivers]
180 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
181 These include libEGL, libGL, and libglesv2 as well as utlity libraries
185 [FILE:591:descriptions/desc.osmesa]
186 Mesa is a 3-D graphics library with an API which is very similar to that
187 of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax or
188 state machine, it is being used with authorization from Silicon Graphics,
189 Inc. However, the author makes no claim that Mesa is in any way a
190 compatible replacement for OpenGL or associated with Silicon Graphics, Inc.
192 This is a Off-Screen version of Mesa in order to do off-screen rendering in
193 other packages like VTK. Offscreen rendering is useful for a
194 number of things, such as batch processing, parallel processing, and
199 3061488b5d85504092cf4343816cfb2d96f2ad9bc2edec31fc96933d184cf58b 11133392 mesa-18.1.4.tar.xz
202 [FILE:721:manifests/plist.libs]
203 @comment lib/libwayland-egl.so
204 @comment lib/libwayland-egl.so.1
205 @comment lib/libwayland-egl.so.1.0.0
206 @comment lib/pkgconfig/wayland-egl.pc
232 include/KHR/khrplatform.h
256 [FILE:245:manifests/plist.clover]
257 %%X86_DRIVERS-ON%%etc/OpenCL/vendors/mesa.icd
258 %%X86_DRIVERS-ON%%lib/
261 libMesaOpenCL.so.1.0.0
262 %%X86_DRIVERS-ON%%lib/gallium-pipe/
270 [FILE:751:manifests/plist.drivers]
271 %%ARM_DRIVERS-ON%%lib/dri/
275 %%X86_DRIVERS-ON%%lib/
280 %%X86_DRIVERS-ON%%lib/dri/
289 radeonsi_drv_video.so
291 %%X86_DRIVERS-ON%%lib/vdpau/
295 libvdpau_r300.so.1.0.0
299 libvdpau_r600.so.1.0.0
301 libvdpau_radeonsi.so.1
302 libvdpau_radeonsi.so.1.0
303 libvdpau_radeonsi.so.1.0.0
305 include/GL/internal/dri_interface.h
312 [FILE:99:manifests/plist.osmesa]
318 lib/pkgconfig/osmesa.pc
321 [FILE:2052:patches/patch-configure]
322 --- configure.orig 2018-06-15 20:37:56 UTC
324 @@ -21548,7 +21548,7 @@ LDFLAGS=$save_LDFLAGS
328 -openbsd* | darwin* )
329 +openbsd* | darwin* | solaris* )
330 LD_NO_UNDEFINED="" ;;
332 if test "x$enable_sanitize" = xno; then
333 @@ -23554,7 +23554,7 @@ fi
338 +linux* | freebsd* | dragonfly*)
342 @@ -27659,9 +27659,6 @@ rm -f core conftest.err conftest.$ac_obj
343 CLANG_LIBDIR=${LLVM_LIBDIR}
345 CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
346 - if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then :
347 - as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5
350 if test "x$enable_opencl" = xyes; then
352 @@ -28996,7 +28993,7 @@ if test "x$enable_llvm" = xyes; then
353 LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
356 - if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 9; then
357 + if false $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 9; then
358 if test "x$enable_llvm_shared_libs" = xyes; then
359 LLVM_LIBS="`$LLVM_CONFIG --link-shared --libs ${LLVM_COMPONENTS}`"
361 @@ -29010,7 +29007,7 @@ if test "x$enable_llvm" = xyes; then
363 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Building mesa with statically linked LLVM may cause compilation issues" >&5
364 $as_echo "$as_me: WARNING: Building mesa with statically linked LLVM may cause compilation issues" >&2;}
365 - if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
366 + if false $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
367 LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
372 [FILE:512:patches/patch-include_GL_internal_dri__interface.h]
373 GCC on 9.x doesn't allow types to be overwritten, these types are defined
374 in drm.h also, which causes build issues in xorg-server.
376 --- include/GL/internal/dri_interface.h.orig 2018-06-15 20:37:48 UTC
377 +++ include/GL/internal/dri_interface.h
379 #ifndef DRI_INTERFACE_H
380 #define DRI_INTERFACE_H
385 -typedef unsigned int drm_context_t;
386 -typedef unsigned int drm_drawable_t;
387 -typedef struct drm_clip_rect drm_clip_rect_t;
394 [FILE:629:patches/patch-src_amd_common_ac__debug.c]
395 --- src/amd/common/ac_debug.c.orig 2018-06-15 20:37:48 UTC
396 +++ src/amd/common/ac_debug.c
397 @@ -560,6 +560,10 @@ void ac_parse_ib_chunk(FILE *f, uint32_t
398 unsigned trace_id_count, enum chip_class chip_class,
399 ac_debug_addr_callback addr_callback, void *addr_callback_data)
402 + printf("\nac_parse_ib_chunk: open_memstream unsupported on solaris");
405 struct ac_ib_parser ib = {};
408 @@ -585,6 +589,7 @@ void ac_parse_ib_chunk(FILE *f, uint32_t
409 printf("\nPacket ends after the end of IB.\n");
418 [FILE:321:patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c]
419 - Define ETIME if missing
421 --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c.orig 2018-06-15 20:37:48 UTC
422 +++ src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
424 #include "radv_amdgpu_bo.h"
428 +#define ETIME ETIMEDOUT
432 VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
435 [FILE:784:patches/patch-src_compiler_glsl_linker.cpp]
436 --- src/compiler/glsl/linker.cpp.orig 2018-06-15 20:37:48 UTC
437 +++ src/compiler/glsl/linker.cpp
439 #include "main/enums.h"
440 #include "main/mtypes.h"
443 +/* uses libbsd4sol prototypes, so can't be static */
449 +strnlen(const char *s, size_t maxlen)
452 + for (len = 0; len < maxlen; len++, s++) {
459 +strndup(const char *str, size_t n)
466 + return strdup(str);
467 + if ((copy = (char *)malloc(len + 1)) == NULL)
469 + memcpy(copy, str, len);
479 [FILE:586:patches/patch-src_egl_drivers_dri2_platform__x11.c]
480 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
482 --- src/egl/drivers/dri2/platform_x11.c.orig 2018-06-15 20:37:48 UTC
483 +++ src/egl/drivers/dri2/platform_x11.c
484 @@ -1469,6 +1469,9 @@ dri2_initialize_x11(_EGLDriver *drv, _EG
486 if (!disp->Options.ForceSoftware) {
488 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
489 + if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
491 if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
492 initialized = dri2_initialize_x11_dri3(drv, disp);
496 [FILE:3256:patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c]
497 Revert the following commit.
499 FreeBSD and DragonFly don't have the required render nodes.
503 From 69a1b9959e59653da262185c4e2cf57d24939b19 Mon Sep 17 00:00:00 2001
504 From: Emil Velikov <emil.l.velikov@gmail.com>
505 Date: Mon, 29 Jun 2015 12:36:45 +0100
506 Subject: pipe-loader: drop support for non-render node devices
508 Render nodes have been around for quite some time. Removing support via
509 the master/primary node allows us to clean up the conditional
510 compilation and simplify the build greatly.
512 For example currently we the pipe-loader, which explicitly links against
513 xcb and friends (for X auth) if found at compile-time. That
514 would cause problems as one will be forced to use X/xcb, even if it's a
515 headless system that is used for opencl.
517 v2: Clarify the linking topic in the commit message.
519 Cc: Tom Stellard <thomas.stellard@amd.com>
520 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
521 Reviewed-by: Francisco Jerez <currojerez@riseup.net>
524 --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2018-06-15 20:37:48 UTC
525 +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
526 @@ -213,6 +213,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa
530 +open_drm_minor(int minor)
532 + char path[PATH_MAX];
533 + snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor);
534 + return open(path, O_RDWR, 0);
538 open_drm_render_node_minor(int minor)
541 @@ -224,8 +232,15 @@ open_drm_render_node_minor(int minor)
543 pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
546 + int i, k, fd, num_render_node_devs;
550 + unsigned vendor_id;
552 + } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
554 + /* Look for render nodes first */
555 for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
556 i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
557 struct pipe_loader_device *dev;
558 @@ -239,6 +254,9 @@ pipe_loader_drm_probe(struct pipe_loader
562 + render_node_devs[j].vendor_id = dev->u.pci.vendor_id;
563 + render_node_devs[j].chip_id = dev->u.pci.chip_id;
568 @@ -248,6 +266,46 @@ pipe_loader_drm_probe(struct pipe_loader
572 + num_render_node_devs = j;
574 + /* Next look for drm devices. */
575 + for (i = 0; i < DRM_MAX_MINOR; i++) {
576 + struct pipe_loader_device *dev;
577 + boolean duplicate = FALSE;
578 + fd = open_drm_minor(i);
582 + if (!pipe_loader_drm_probe_fd(&dev, fd)) {
587 + /* Check to make sure we aren't already accessing this device via
590 + for (k = 0; k < num_render_node_devs; k++) {
591 + if (dev->u.pci.vendor_id == render_node_devs[k].vendor_id &&
592 + dev->u.pci.chip_id == render_node_devs[k].chip_id) {
594 + dev->ops->release(&dev);
606 + dev->ops->release(&dev);
617 [FILE:257:patches/patch-src_gallium_auxiliary_util_u__math.h]
618 --- src/gallium/auxiliary/util/u_math.h.orig 2018-06-15 20:37:48 UTC
619 +++ src/gallium/auxiliary/util/u_math.h
621 #include "util/bitscan.h"
625 +#define restrict __restrict__
632 [FILE:357:patches/patch-src_gallium_drivers_radeonsi_si__shader.c]
633 --- src/gallium/drivers/radeonsi/si_shader.c.orig 2018-06-15 20:37:48 UTC
634 +++ src/gallium/drivers/radeonsi/si_shader.c
636 * USE OR OTHER DEALINGS IN THE SOFTWARE.
640 +#include <alloca.h> /* for alloca */
643 #include "gallivm/lp_bld_const.h"
644 #include "gallivm/lp_bld_gather.h"
645 #include "gallivm/lp_bld_intr.h"
648 [FILE:511:patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c]
649 --- src/gallium/drivers/radeonsi/si_state_shaders.c.orig 2018-06-15 20:37:48 UTC
650 +++ src/gallium/drivers/radeonsi/si_state_shaders.c
651 @@ -1515,6 +1515,7 @@ static void si_build_shader_variant(stru
656 if (shader->compiler_ctx_state.is_debug_context) {
657 FILE *f = open_memstream(&shader->shader_log,
658 &shader->shader_log_size);
659 @@ -1523,6 +1524,7 @@ static void si_build_shader_variant(stru
665 si_shader_init_pm4_state(sscreen, shader);
669 [FILE:360:patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c]
670 # define ETIME as ETIMEOUT same as in intel driver
672 --- src/gallium/drivers/vc4/vc4_bufmgr.c.orig 2018-06-15 20:37:48 UTC
673 +++ src/gallium/drivers/vc4/vc4_bufmgr.c
677 #include <xf86drmMode.h>
679 +#define ETIME ETIMEDOUT
682 #include "util/u_hash_table.h"
683 #include "util/u_memory.h"
686 [FILE:1043:patches/patch-src_gallium_include_pipe_p__config.h]
687 --- src/gallium/include/pipe/p_config.h.orig 2018-06-15 20:37:48 UTC
688 +++ src/gallium/include/pipe/p_config.h
693 +#if defined(__sparc__) || defined(__sparc64__)
694 +#define PIPE_ARCH_SPARC
695 +#if defined(__sparc64__)
696 +#define PIPE_ARCH_SPARC_64
702 * Processor architecture
705 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
706 #define PIPE_ARCH_LITTLE_ENDIAN
707 -#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
708 +#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_SPARC) || defined(PIPE_ARCH_SPARC_64)
709 #define PIPE_ARCH_BIG_ENDIAN
713 #define PIPE_OS_ANDROID
716 +#if defined(__DragonFly__)
717 +#define PIPE_OS_DRAGONFLY
719 +#define PIPE_OS_UNIX
722 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
723 #define PIPE_OS_FREEBSD
727 [FILE:1604:patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp]
728 # fix errors like the following
730 # llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str()
732 # /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas
733 ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC
734 # /usr/bin/ld: final link failed: Bad value
736 --- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2018-06-15 20:37:48 UTC
737 +++ src/gallium/state_trackers/clover/llvm/invocation.cpp
738 @@ -181,6 +181,8 @@ namespace {
739 return get_lang_standard_from_version_str(device_version);
742 + const char* cstr(const std::string& str) { return str.c_str(); }
744 std::unique_ptr<clang::CompilerInstance>
745 create_compiler_instance(const device &dev,
746 const std::vector<std::string> &opts,
747 @@ -193,8 +195,8 @@ namespace {
748 // Parse the compiler options. A file name should be present at the end
749 // and must have the .cl extension in order for the CompilerInvocation
750 // class to recognize it as an OpenCL source file.
751 - const std::vector<const char *> copts =
752 - map(std::mem_fn(&std::string::c_str), opts);
753 + std::vector<const char *> copts(opts.size());
754 + std::transform(opts.begin(), opts.end(), copts.begin(), cstr);
756 const target &target = dev.ir_target();
757 const std::string &device_clc_version = dev.device_clc_version();
760 [FILE:635:patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp]
761 # Fix error: no matching constructor for initialization of 'std::vector<const ::llvm::MDNode *>'
763 --- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig 2018-06-15 20:37:48 UTC
764 +++ src/gallium/state_trackers/clover/llvm/metadata.hpp
765 @@ -42,7 +42,7 @@ namespace clover {
766 get_kernel_nodes(const ::llvm::Module &mod) {
767 if (const ::llvm::NamedMDNode *n =
768 mod.getNamedMetadata("opencl.kernels"))
769 - return { n->op_begin(), n->op_end() };
770 + return { n->getOperand(0), n->getOperand(n->getNumOperands()) };
776 [FILE:1150:patches/patch-src_gallium_state__trackers_clover_util_range.hpp]
777 From b95533b981af9a6687b41418e7cc2a5652fc2bdb Mon Sep 17 00:00:00 2001
778 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
779 Date: Fri, 7 Mar 2014 15:16:08 +0100
780 Subject: [PATCH 3/3] Work around for clang 3.4 which fails to build Clover
783 https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3
784 --- src/gallium/state_trackers/clover/util/range.hpp.orig 2018-06-15 20:37:48 UTC
785 +++ src/gallium/state_trackers/clover/util/range.hpp
786 @@ -362,6 +362,12 @@ namespace clover {
791 + template<typename T>
792 + using fixup_function_type =
793 + typename std::conditional<std::is_function<T>::value, T &, T>::type;
797 /// Create a range by transforming the contents of a number of
798 /// source ranges \a rs element-wise using a provided functor \a f.
799 @@ -369,7 +375,7 @@ namespace clover {
800 /// \sa adaptor_range.
802 template<typename F, typename... Rs>
803 - adaptor_range<F, Rs...>
804 + adaptor_range<detail::fixup_function_type<F>, Rs...>
805 map(F &&f, Rs &&... rs) {
806 return { std::forward<F>(f), std::forward<Rs>(rs)... };
810 [FILE:323:patches/patch-src_gallium_winsys_amdgpu_drm_amdgpu__cs.c]
811 --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c.orig 2018-06-15 20:37:48 UTC
812 +++ src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
814 #define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3)
821 DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
826 [FILE:575:patches/patch-src_glx_glxext.c]
827 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
829 --- src/glx/glxext.c.orig 2018-06-15 20:37:48 UTC
831 @@ -920,6 +920,9 @@ __glXInitialize(Display * dpy)
832 #if defined(GLX_USE_DRM)
833 if (glx_direct && glx_accel) {
834 #if defined(HAVE_DRI3)
835 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
836 + if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
838 if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
839 dpyPriv->dri3Display = dri3_create_display(dpy);
840 #endif /* HAVE_DRI3 */
843 [FILE:686:patches/patch-src_intel_Makefile.in]
844 ../../src/util/.libs/libmesautil.a(libmesautil_la-half_float.o): In function `_mesa_float_to_half':
845 half_float.c:(.text+0x94): undefined reference to `lrintf'
846 half_float.c:(.text+0xbf): undefined reference to `lrintf'
847 cc: error: linker command failed with exit code 1 (use -v to see invocation)
848 gmake[5]: *** [Makefile:2706: tools/aubinator_error_decode] Error 1
850 --- src/intel/Makefile.in.orig 2018-06-15 20:38:01 UTC
851 +++ src/intel/Makefile.in
852 @@ -2099,7 +2099,8 @@ tools_aubinator_error_decode_LDADD = \
854 $(top_builddir)/src/util/libmesautil.la \
860 tools_aubinator_error_decode_CFLAGS = \
864 [FILE:995:patches/patch-src_intel_compiler_brw__eu__validate.c]
865 --- src/intel/compiler/brw_eu_validate.c.orig 2018-06-15 20:37:48 UTC
866 +++ src/intel/compiler/brw_eu_validate.c
875 +memmem(const void *l, size_t l_len, const void *s, size_t s_len)
878 + const char *cl = (const char *)l;
879 + const char *cs = (const char *)s;
881 + /* we need something to compare */
882 + if (l_len == 0 || s_len == 0)
885 + /* "s" must be smaller or equal to "l" */
889 + /* special case where s_len == 1 */
891 + return memchr(l, (int)*cs, l_len);
893 + /* the last position where its possible to find "s" in "l" */
894 + last = (char *)cl + l_len - s_len;
896 + for (cur = (char *)cl; cur <= last; cur++)
897 + if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
904 /* We're going to do lots of string concatenation, so this should help. */
909 [FILE:794:patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp]
910 compiler/brw_fs_bank_conflicts.cpp:719:25: error: scalar initializer cannot be empty
911 vector_type s_p = {}, s_n = {};
913 compiler/brw_fs_bank_conflicts.cpp:719:35: error: scalar initializer cannot be empty
914 vector_type s_p = {}, s_n = {};
917 --- src/intel/compiler/brw_fs_bank_conflicts.cpp.orig 2018-06-15 20:37:48 UTC
918 +++ src/intel/compiler/brw_fs_bank_conflicts.cpp
919 @@ -716,7 +716,7 @@ namespace {
920 const weight_vector_type &conflicts)
922 const unsigned m = DIV_ROUND_UP(conflicts.size, vector_width);
923 - vector_type s_p = {}, s_n = {};
924 + vector_type s_p = {0}, s_n = {0};
926 for (unsigned r = 0; r < m; r++) {
927 s_p = adds(s_p, mask(bank_mask_p.v[r], conflicts.v[r]));
930 [FILE:225:patches/patch-src_intel_isl_isl.h]
931 --- src/intel/isl/isl.h.orig 2018-06-15 20:37:48 UTC
932 +++ src/intel/isl/isl.h
934 #include "util/macros.h"
938 +# define restrict __restrict__
945 [FILE:302:patches/patch-src_intel_tools_aubinator__error__decode.c]
946 # expose getline in FreeBSD's stdio.h
948 --- src/intel/tools/aubinator_error_decode.c.orig 2018-06-15 20:37:48 UTC
949 +++ src/intel/tools/aubinator_error_decode.c
955 +#define _WITH_GETLINE
962 [FILE:619:patches/patch-src_mapi_glapi_gen_gl__gentable.py]
963 --- src/mapi/glapi/gen/gl_gentable.py.orig 2018-06-15 20:37:48 UTC
964 +++ src/mapi/glapi/gen/gl_gentable.py
965 @@ -43,7 +43,7 @@ header = """/* GLXEXT is the define used
968 #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
969 - || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__))
970 + || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__))
971 #define USE_BACKTRACE
976 [FILE:425:patches/patch-src_mesa_drivers_dri_i965_brw__bufmgr.c]
977 --- src/mesa/drivers/dri/i965/brw_bufmgr.c.orig 2018-06-15 20:37:48 UTC
978 +++ src/mesa/drivers/dri/i965/brw_bufmgr.c
987 /* VALGRIND_FREELIKE_BLOCK unfortunately does not actually undo the earlier
988 * VALGRIND_MALLOCLIKE_BLOCK but instead leaves vg convinced the memory is
989 * leaked. All because it does not call VG(cli_free) from its
992 [FILE:1350:patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c]
993 --- src/mesa/drivers/dri/i965/brw_performance_query.c.orig 2018-06-15 20:37:48 UTC
994 +++ src/mesa/drivers/dri/i965/brw_performance_query.c
995 @@ -1806,9 +1806,17 @@ enumerate_sysfs_metrics(struct brw_conte
996 while ((metric_entry = readdir(metricsdir))) {
997 struct hash_entry *entry;
1000 + struct stat entry_stat;
1002 + lstat(metric_entry->d_name, &entry_stat);
1003 + if ((!S_ISDIR(entry_stat.st_mode) && !S_ISLNK(entry_stat.st_mode)) ||
1004 + metric_entry->d_name[0] == '.')
1006 if ((metric_entry->d_type != DT_DIR &&
1007 metric_entry->d_type != DT_LNK) ||
1008 metric_entry->d_name[0] == '.')
1012 DBG("metric set: %s\n", metric_entry->d_name);
1013 @@ -2082,9 +2090,17 @@ get_sysfs_dev_dir(struct brw_context *br
1016 while ((drm_entry = readdir(drmdir))) {
1018 + struct stat drm_stat;
1020 + lstat(drm_entry->d_name, &drm_stat);
1021 + if ((S_ISDIR(drm_stat.st_mode) || S_ISLNK(drm_stat.st_mode)) &&
1022 + strncmp(drm_entry->d_name, "card", 4) == 0)
1024 if ((drm_entry->d_type == DT_DIR ||
1025 drm_entry->d_type == DT_LNK) &&
1026 strncmp(drm_entry->d_name, "card", 4) == 0)
1029 len = snprintf(brw->perfquery.sysfs_dev_dir,
1030 sizeof(brw->perfquery.sysfs_dev_dir),
1033 [FILE:406:patches/patch-src_mesa_main_compiler.h]
1034 --- src/mesa/main/compiler.h.orig 2018-06-15 20:37:48 UTC
1035 +++ src/mesa/main/compiler.h
1037 #if defined(__linux__)
1038 #include <byteswap.h>
1039 #define CPU_TO_LE32( x ) bswap_32( x )
1040 +#elif defined(__FreeBSD__)
1041 +#include <sys/endian.h>
1042 +#define CPU_TO_LE32( x ) bswap32( x )
1043 #elif defined(__APPLE__)
1044 #include <CoreFoundation/CFByteOrder.h>
1045 #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
1048 [FILE:377:patches/patch-src_util_build__id.c]
1049 # Elf_ doesn't exist, use Elf32_ or Elf64_
1051 --- src/util/build_id.c.orig 2018-06-15 20:37:48 UTC
1052 +++ src/util/build_id.c
1057 -#define ElfW(type) Elf_##type
1059 +#define ElfW(type) Elf64_##type
1061 +#define ElfW(type) Elf32_##type
1065 #define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
1068 [FILE:649:patches/patch-src_util_disk__cache.c]
1069 --- src/util/disk_cache.c.orig 2018-06-15 20:37:48 UTC
1070 +++ src/util/disk_cache.c
1073 #include "disk_cache.h"
1076 +#define O_CLOEXEC 0
1079 /* Number of bits to mask off from a cache key to get an index. */
1080 #define CACHE_INDEX_KEY_BITS 16
1082 @@ -513,7 +517,11 @@ choose_lru_file_matching(const char *dir
1087 + if (fstatat(dir->dd_fd, entry->d_name, &sb, 0) == 0) {
1089 if (fstatat(dirfd(dir), entry->d_name, &sb, 0) == 0) {
1091 if (!lru_atime || (sb.st_atime < lru_atime)) {
1092 size_t len = strlen(entry->d_name);
1096 [FILE:1462:patches/patch-src_util_futex.h]
1097 - Implement futex_wake() and futex_wait() via _umtx_op()
1099 --- src/util/futex.h.orig 2018-06-15 20:37:48 UTC
1100 +++ src/util/futex.h
1105 +#if defined(__FreeBSD__)
1107 +# if __FreeBSD__ < 11
1108 +# include <machine/atomic.h>
1110 +#include <sys/umtx.h>
1112 #include <linux/futex.h>
1113 #include <sys/syscall.h>
1115 #include <sys/time.h>
1117 +#if defined(__FreeBSD__)
1118 +static inline int futex_wake(uint32_t *addr, int count)
1120 + return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
1123 +static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
1125 + void *uaddr = NULL, *uaddr2 = NULL;
1126 + if (timeout != NULL) {
1127 + const struct _umtx_time tmo = { ._timeout = *timeout, ._flags = UMTX_ABSTIME, ._clockid = CLOCK_MONOTONIC };
1128 + uaddr = (void *)(uintptr_t)sizeof(tmo);
1129 + uaddr2 = (void *)&tmo;
1131 + return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == -1 ? errno : 0;
1134 static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
1136 return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
1137 @@ -50,6 +75,7 @@ static inline int futex_wait(uint32_t *a
1138 return sys_futex(addr, FUTEX_WAIT_BITSET, value, timeout, NULL,
1139 FUTEX_BITSET_MATCH_ANY);
1147 [FILE:360:patches/patch-src_util_os__time.c]
1148 - Use monotonic clock for timeouts
1150 --- src/util/os_time.c.orig 2018-06-15 20:37:48 UTC
1151 +++ src/util/os_time.c
1152 @@ -95,7 +95,7 @@ os_time_get_nano(void)
1154 os_time_sleep(int64_t usecs)
1156 -#if defined(PIPE_OS_LINUX)
1157 +#if defined(HAVE_CLOCK_NANOSLEEP)
1158 struct timespec time;
1159 time.tv_sec = usecs / 1000000;
1160 time.tv_nsec = (usecs % 1000000) * 1000;
1163 [FILE:430:patches/patch-src_util_u__atomic.h]
1164 --- src/util/u_atomic.h.orig 2018-06-15 20:37:48 UTC
1165 +++ src/util/u_atomic.h
1167 * locally coded assembly, compiler intrinsic or ultimately a
1168 * mutex-based implementation.
1171 -#define PIPE_ATOMIC_OS_SOLARIS
1172 -#elif defined(_MSC_VER)
1173 -#define PIPE_ATOMIC_MSVC_INTRINSIC
1174 -#elif defined(__GNUC__)
1175 +#if defined(__GNUC__)
1176 #define PIPE_ATOMIC_GCC_INTRINSIC
1178 #error "Unsupported platform"
1181 [FILE:1162:patches/patch-src_util_u__thread.h]
1182 - Implement setting thread name
1183 - Use monotonic clock for timeouts
1185 --- src/util/u_thread.h.orig 2018-06-15 20:37:48 UTC
1186 +++ src/util/u_thread.h
1191 +#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
1192 +#include <pthread_np.h>
1193 +#undef ALIGN /* Avoid conflict on FreeBSD in main/macros.h */
1198 @@ -65,6 +69,12 @@ static inline void u_thread_setname( con
1199 (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
1201 pthread_setname_np(pthread_self(), name);
1202 +# elif defined(__sun)
1203 + pthread_setname_np(pthread_self(), name);
1204 +# elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
1205 + pthread_set_name_np(pthread_self(), name);
1206 +# elif defined(__NetBSD__)
1207 + pthread_setname_np(pthread_self(), "%s", (void*)name);
1211 @@ -78,7 +88,7 @@ static inline void u_thread_setname( con
1212 static inline int64_t
1213 u_thread_get_time_nano(thrd_t thread)
1215 -#if defined(__linux__) && defined(HAVE_PTHREAD)
1216 +#if defined(HAVE_PTHREAD)
1222 [FILE:47:files/special.mk]
1223 DRI_DRIVERS+= SWRAST
1224 GALLIUM_DRIVERS+= SWRAST
1227 [FILE:684:dragonfly/patch-src_intel_tools_aubinator.c]
1228 # We don't have MAP_NORESERVE so use MAP_NOSYNC | MAP_NOCORE and
1229 # hope for the best (this alloc is too big but it's only a test)
1231 --- src/intel/tools/aubinator.c.orig 2018-06-15 20:37:48 UTC
1232 +++ src/intel/tools/aubinator.c
1233 @@ -633,7 +633,7 @@ int main(int argc, char *argv[])
1234 /* mmap a terabyte for our gtt space. */
1235 gtt_size = 1ull << 40;
1236 gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
1237 - MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
1238 + MAP_PRIVATE | MAP_ANONYMOUS | MAP_NOSYNC | MAP_NOCORE, -1, 0);
1239 if (gtt == MAP_FAILED) {
1240 fprintf(stderr, "failed to alloc gtt space: %s\n", strerror(errno));
1244 [FILE:684:freebsd/patch-src_intel_tools_aubinator.c]
1245 # We don't have MAP_NORESERVE so use MAP_NOSYNC | MAP_NOCORE and
1246 # hope for the best (this alloc is too big but it's only a test)
1248 --- src/intel/tools/aubinator.c.orig 2018-06-15 20:37:48 UTC
1249 +++ src/intel/tools/aubinator.c
1250 @@ -633,7 +633,7 @@ int main(int argc, char *argv[])
1251 /* mmap a terabyte for our gtt space. */
1252 gtt_size = 1ull << 40;
1253 gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
1254 - MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
1255 + MAP_PRIVATE | MAP_ANONYMOUS | MAP_NOSYNC | MAP_NOCORE, -1, 0);
1256 if (gtt == MAP_FAILED) {
1257 fprintf(stderr, "failed to alloc gtt space: %s\n", strerror(errno));
1261 [FILE:722:sunos/patch-src_amd_Makefile.in]
1262 --- src/amd/Makefile.in.orig 2018-01-18 21:30:38 UTC
1263 +++ src/amd/Makefile.in
1264 @@ -332,7 +332,7 @@ CCAS = @CCAS@
1265 CCASDEPMODE = @CCASDEPMODE@
1266 CCASFLAGS = @CCASFLAGS@
1267 CCDEPMODE = @CCDEPMODE@
1269 +CFLAGS = @CFLAGS@ -I$(prefix)/include/bsd
1270 CLANG_RESOURCE_DIR = @CLANG_RESOURCE_DIR@
1271 CLOCK_LIB = @CLOCK_LIB@
1272 CLOVER_STD_OVERRIDE = @CLOVER_STD_OVERRIDE@
1273 @@ -739,7 +739,7 @@ addrlib_libamdgpu_addrlib_la_SOURCES = $
1274 @HAVE_GALLIUM_LLVM_TRUE@ $(AMD_GENERATED_FILES) \
1275 @HAVE_GALLIUM_LLVM_TRUE@ $(AMD_NIR_FILES)
1277 -common_libamd_common_la_LIBADD = $(LIBELF_LIBS)
1278 +common_libamd_common_la_LIBADD = $(LIBELF_LIBS) -lbsd
1279 BUILT_SOURCES = $(AMD_GENERATED_FILES)
1280 all: $(BUILT_SOURCES)
1281 $(MAKE) $(AM_MAKEFLAGS) all-am
1284 [FILE:360:sunos/patch-src_compiler_Makefile.in]
1285 --- src/compiler/Makefile.in.orig 2018-01-18 21:30:39 UTC
1286 +++ src/compiler/Makefile.in
1287 @@ -731,7 +731,7 @@ CLANG_RESOURCE_DIR = @CLANG_RESOURCE_DIR
1288 CLOCK_LIB = @CLOCK_LIB@
1289 CLOVER_STD_OVERRIDE = @CLOVER_STD_OVERRIDE@
1291 -CPPFLAGS = @CPPFLAGS@
1292 +CPPFLAGS = @CPPFLAGS@ -I$(prefix)/include/bsd
1295 CXXDEPMODE = @CXXDEPMODE@
1298 [FILE:343:sunos/patch-src_intel_Makefile.in]
1299 --- src/intel/Makefile.in.orig 2018-02-07 05:00:00 UTC
1300 +++ src/intel/Makefile.in
1301 @@ -1983,7 +1983,7 @@ tools_aubinator_error_decode_LDADD = \
1303 tools_aubinator_error_decode_CFLAGS = \
1306 + $(ZLIB_CFLAGS) -I$(prefix)/include/bsd
1309 # Due to a what seems like a autoconf bug, we must ensure that the genaration
1312 [FILE:760:sunos/patch-src_mesa_drivers_dri_common_Makefile.in]
1313 --- src/mesa/drivers/dri/common/Makefile.in.orig 2018-01-18 21:30:42 UTC
1314 +++ src/mesa/drivers/dri/common/Makefile.in
1315 @@ -138,7 +138,7 @@ AM_V_lt = $(am__v_lt_@AM_V@)
1316 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
1317 am__v_lt_0 = --silent
1319 -libmegadriver_stub_la_LIBADD =
1320 +libmegadriver_stub_la_LIBADD = -lbsd
1321 am__objects_2 = megadriver_stub.lo
1322 am_libmegadriver_stub_la_OBJECTS = $(am__objects_2)
1323 libmegadriver_stub_la_OBJECTS = $(am_libmegadriver_stub_la_OBJECTS)
1324 @@ -224,7 +224,7 @@ CCAS = @CCAS@
1325 CCASDEPMODE = @CCASDEPMODE@
1326 CCASFLAGS = @CCASFLAGS@
1327 CCDEPMODE = @CCDEPMODE@
1329 +CFLAGS = @CFLAGS@ -I$(prefix)/include/bsd
1330 CLANG_RESOURCE_DIR = @CLANG_RESOURCE_DIR@
1331 CLOCK_LIB = @CLOCK_LIB@
1332 CLOVER_STD_OVERRIDE = @CLOVER_STD_OVERRIDE@
1335 [FILE:927:sunos/patch-src_util_Makefile.in]
1336 --- src/util/Makefile.in.orig 2018-01-18 21:30:42 UTC
1337 +++ src/util/Makefile.in
1338 @@ -865,6 +865,7 @@ libmesautil_la_CPPFLAGS = \
1339 -I$(top_srcdir)/src/mesa \
1340 -I$(top_srcdir)/src/gallium/include \
1341 -I$(top_srcdir)/src/gallium/auxiliary \
1342 + -I$(prefix)/include/bsd \
1343 $(VISIBILITY_CFLAGS) \
1344 $(MSVC2013_COMPAT_CFLAGS) \
1346 @@ -876,18 +877,19 @@ libmesautil_la_SOURCES = \
1347 libmesautil_la_LIBADD = \
1351 + $(LIBATOMIC_LIBS) -lbsd
1353 libxmlconfig_la_SOURCES = $(XMLCONFIG_FILES)
1354 libxmlconfig_la_CFLAGS = \
1356 -I$(top_srcdir)/include \
1357 -I$(top_srcdir)/src \
1358 + -I$(prefix)/include/bsd \
1359 -DSYSCONFDIR=\"$(sysconfdir)\" \
1360 $(VISIBILITY_CFLAGS) \
1363 -libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
1364 +libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm -lbsd
1365 sysconf_DATA = drirc
1366 u_atomic_test_LDADD = libmesautil.la
1367 roundeven_test_LDADD = -lm