Ravenports generated: 02 Dec 2019 21:21
[ravenports.git] / bucket_F0 / mesa
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               mesa
4 VERSION=                19.2.6
5 KEYWORDS=               graphics
6 VARIANTS=               standard
7 SDESC[standard]=        Mesa 3D Graphics Library
8 HOMEPAGE=               https://www.mesa3d.org/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            https://mesa.freedesktop.org/archive/
13                         ftp://ftp.freedesktop.org/pub/mesa/
14 DISTFILE[1]=            mesa-19.2.6.tar.xz:main
15 DF_INDEX=               1
16 SPKGS[standard]=        complete
17                         libs
18                         drivers
19
20 OPTIONS_AVAILABLE=      X86_DRIVERS ARM_DRIVERS LLVMPIPE WAYLAND
21 OPTIONS_STANDARD=       X86_DRIVERS ARM_DRIVERS LLVMPIPE
22 OPT_ON[freebsd]=        LLVMPIPE//i386|x86_64
23 OPT_ON[aarch64]=        ARM_DRIVERS
24 OPT_ON[linux]=          LLVMPIPE//i386|x86_64
25 OPT_ON[x86_64]=         X86_DRIVERS
26 OPT_ON[dragonfly]=      LLVMPIPE//i386|x86_64
27 OPT_ON[i386]=           X86_DRIVERS
28
29 BUILD_DEPENDS=          autoselect-python:single:standard
30                         python-Mako:single:python_used
31                         libpthread-stubs:single:standard
32                         zlib:static:standard
33                         libelf:single:standard
34                         libvdpau:single:standard
35                         libva:single:standard
36                         expat:static:standard
37 BUILDRUN_DEPENDS=       expat:shared:standard
38                         zlib:shared:standard
39                         libdrm:single:standard
40 EXRUN[drivers]=         mesa:libs:standard
41                         libelf:single:standard
42
43 USES=                   bison gettext-tools gmake meson pkgconfig
44                         python:build shebangfix solaris-funcs
45                         c++:libs,drivers
46 XORG_COMPONENTS=        x11 xdamage xext xfixes xshmfence xxf86vm xv xrandr
47                         xcb
48
49 LICENSE=                MIT:libs CUSTOM1:libs CUSTOM2:libs
50 LICENSE_NAME=           CUSTOM1:"Kronos License (MIT with modifications)"
51                         CUSTOM2:"SGI Free Software License B"
52 LICENSE_FILE=           MIT:{{WRKDIR}}/LICENSE_MIT
53                         CUSTOM1:{{WRKDIR}}/LICENSE_KHRONOS
54                         CUSTOM2:{{WRKDIR}}/LICENSE_SGI
55 LICENSE_AWK=            MIT:"^$$"
56                         CUSTOM2:"^$$"
57 LICENSE_SOURCE=         MIT:{{WRKSRC}}/include/GL/gl.h
58                         CUSTOM2:{{WRKSRC}}/src/glx/eval.c
59 LICENSE_SCHEME=         multi
60
61 FPC_EQUIVALENT=         graphics/mesa-libs
62 MESON_ARGS=             -Dplatforms=x11,drm{{WAYPLAT}}
63                         -Ddri3=true
64                         -Ddri-drivers={{DRI_DRIVERS:tW:tl:C/[[:space:]]/,/g}}
65                         -Dgallium-drivers={{GALLIUM_DRIVERS:tW:tl:C/[[:space:]]/,/g}}
66                         -Dgallium-vdpau=true
67                         -Dosmesa=gallium
68                         -Dlibunwind=false
69                         -Dgles1=false
70                         -Dvulkan-drivers={{VULKAN_DRIVERS:tW:tl:C/[[:space:]]/,/g}}
71 SHEBANG_FILES=          src/gallium/*/*/*.py
72                         src/gallium/tools/trace/*.py
73                         src/gallium/drivers/svga/svgadump/svga_dump.py
74                         src/mapi/glapi/gen/*.py
75                         src/mapi/mapi_abi.py
76                         src/util/xmlpool/gen_xmlpool.py
77                         src/mesa/main/get_*.py
78                         src/util/format_srgb.py
79                         src/amd/*/*.py
80                         src/intel/genxml/gen_pack_header.py
81 SHEBANG_OLD_PYTHON=     /usr/bin/env[[:space:]]python2
82                         /usr/bin/python2
83                         /bin/env[[:space:]]python
84 SOL_FUNCTIONS=          dirfd:src/util/disk_cache.c
85                         asprintf:src/util/anon_file.c
86                         asprintf:src/mesa/drivers/dri/common/megadriver_stub.c
87                         asprintf:src/loader/loader.c
88                         asprintf:src/egl/main/eglcurrent.c
89                         asprintf:src/util/u_string.h
90                         strnlen:src/util/ralloc.c
91                         strnlen:src/mesa/main/errors.c
92                         strndup:src/util/xmlconfig.c
93                         strndup:src/loader/loader.c
94                         strndup:src/egl/drivers/dri2/platform_x11.c
95
96 CONFIGURE_ENV=          ax_cv_check_cflags___Wno_initializer_overrides=no
97
98 INSTALL_TARGET=         install-strip
99 INSTALL_REQ_TOOLCHAIN=  yes
100
101 VAR_OPSYS[sunos]=       CPPFLAGS=-D__EXTENSIONS__=1
102                         CPPFLAGS=-Wno-unused-function
103                         CXXFLAGS=-Drestrict=__restrict__
104                         CFLAGS=-D_POSIX_PTHREAD_SEMANTICS
105                         CFLAGS=-DF_DUPFD_CLOEXEC=F_DUPFD
106                         LDFLAGS=-lsocket
107                         LDFLAGS=-lnsl
108
109 [ARM_DRIVERS].DESCRIPTION=              Build drivers for aarch64 architecture
110 [ARM_DRIVERS].MAKEFILE_ON=              GALLIUM_DRIVERS+=FREEDRENO
111                                         GALLIUM_DRIVERS+=VC4
112
113 [X86_DRIVERS].DESCRIPTION=              Build drivers for i386 and x86_64 architectures
114 [X86_DRIVERS].MAKEFILE_ON=              DRI_DRIVERS+=R100
115                                         DRI_DRIVERS+=R200
116                                         DRI_DRIVERS+=I915
117                                         DRI_DRIVERS+=I965
118                                         GALLIUM_DRIVERS+=R300
119                                         GALLIUM_DRIVERS+=SVGA
120                                         GALLIUM_DRIVERS+={{GALLIUM_LLVM_DRIVERS}}
121                                         VULKAN_DRIVERS+={{VULKAN_DRIVERS_X86}}
122
123 [WAYLAND].DESCRIPTION=                  Build Vulkan drivers for Wayland platform
124 [WAYLAND].BUILDRUN_DEPENDS_ON=          wayland:primary:standard
125 [WAYLAND].BUILD_DEPENDS_ON=             wayland-protocols:single:standard
126                                         python-Mako:single:python_default
127 [WAYLAND].MAKEFILE_ON=                  WAYPLAT=,surfaceless,wayland
128                                         VULKAN_DRIVERS+=INTEL
129                                         VULKAN_DRIVERS_X86+=RADEON
130
131 [LLVMPIPE].DESCRIPTION=                 Build LLVM-based drivers and libraries
132 [LLVMPIPE].BUILDRUN_DEPENDS_ON=         llvm:single:standard
133                                         opencl:single:standard
134                                         ocl-icd:primary:standard
135 [LLVMPIPE].BUILD_DEPENDS_ON=            libclc:single:standard
136                                         clang:compiler:standard
137 [LLVMPIPE].MAKEFILE_OFF=                MESON_ARGS+=-Dgallium-opencl=disabled
138 [LLVMPIPE].MAKEFILE_ON=                 GALLIUM_LLVM_DRIVERS+=R600
139                                         GALLIUM_LLVM_DRIVERS+=RADEONSI
140                                         MESON_ARGS+=-Dllvm=true
141                                         MESON_ARGS+=-Dgallium-xvmc=true
142                                         MESON_ARGS+=-Dgallium-va=true
143                                         MESON_ARGS+=-Dgallium-opencl=icd
144 [LLVMPIPE].XORG_COMPONENTS_ON=          xvmc
145
146 post-patch:
147         ${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' \
148                 ${WRKSRC}/src/util/xmlconfig.c
149
150 post-extract:
151         ${AWK} '/Copyright/,/DEALINGS/' ${WRKSRC}/include/GL/glext.h \
152                 > ${WRKDIR}/LICENSE_KHRONOS
153
154 [FILE:1198:descriptions/desc.libs]
155 The Mesa project began as an open-source implementation of the OpenGL
156 specification - a system for rendering interactive 3D graphics.
157
158 Over the years the project has grown to implement more graphics APIs,
159 including OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API,
160 XvMC and Vulkan.
161
162 A variety of device drivers allows the Mesa libraries to be used in many
163 different environments ranging from software emulation to complete
164 hardware acceleration for modern GPUs.
165
166 Mesa ties into several other open-source projects: the Direct Rendering
167 Infrastructure and X.org to provide OpenGL support on Linux, FreeBSD
168 and other operating systems.
169
170 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
171 These include libOSMesa, libEGL, libGL, and libglesv2 as well as utility
172 libraries libglapi and gbm.  The OSMesa library is an Off-Screen version
173 of Mesa in order to do off-screen rendering in other packages like VTK.
174 Offscreen rendering is useful for a number of things, such as batch
175 processing, parallel processing, and remote processing.
176
177 This package also contains Mesa's libOpenCL implementation "Clover".  It is
178 built upon GALLIUM and currently only supports Radeon GPUs.
179
180
181 [FILE:162:descriptions/desc.drivers]
182 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
183 These include libEGL, libGL, and libglesv2 as well as utlity libraries
184 libglapi and gbm.
185
186
187 [FILE:97:distinfo]
188 9d7b24fa60c82db34788196450042a55ce6cb2d70c7a8d5c31401619b6907797     11460244 mesa-19.2.6.tar.xz
189
190
191 [FILE:981:manifests/plist.libs]
192 %%LLVMPIPE-ON%%etc/OpenCL/vendors/mesa.icd
193 %%LLVMPIPE-ON%%lib/
194  libMesaOpenCL.so
195  libMesaOpenCL.so.1
196  libMesaOpenCL.so.1.0.0
197 %%LLVMPIPE-ON%%lib/gallium-pipe/
198  pipe_r300.so
199  pipe_r600.so
200  pipe_radeonsi.so
201  pipe_swrast.so
202  pipe_vmwgfx.so
203 include/
204  gbm.h
205  xa_composite.h
206  xa_context.h
207  xa_tracker.h
208 include/EGL/
209  egl.h
210  eglext.h
211  eglextchromium.h
212  eglmesaext.h
213  eglplatform.h
214 include/GL/
215  gl.h
216  glcorearb.h
217  glext.h
218  glx.h
219  glxext.h
220  osmesa.h
221 include/GLES2/
222  gl2.h
223  gl2ext.h
224  gl2platform.h
225 include/GLES3/
226  gl3.h
227  gl31.h
228  gl32.h
229  gl3ext.h
230  gl3platform.h
231 include/KHR/khrplatform.h
232 lib/
233  libEGL.so
234  libEGL.so.1
235  libEGL.so.1.0.0
236  libGL.so
237  libGL.so.1
238  libGL.so.1.2.0
239  libGLESv2.so
240  libGLESv2.so.2
241  libGLESv2.so.2.0.0
242  libOSMesa.so
243  libOSMesa.so.8
244  libOSMesa.so.8.0.0
245  libgbm.so
246  libgbm.so.1
247  libgbm.so.1.0.0
248  libglapi.so
249  libglapi.so.0
250  libglapi.so.0.0.0
251  libxatracker.so
252  libxatracker.so.2
253  libxatracker.so.2.5.0
254 lib/pkgconfig/
255  egl.pc
256  gbm.pc
257  gl.pc
258  glesv2.pc
259  osmesa.pc
260  xatracker.pc
261
262
263 [FILE:762:manifests/plist.drivers]
264 %%ARM_DRIVERS-ON%%lib/dri/
265  kgsl_dri.so
266  msm_dri.so
267  vc4_dri.so
268 %%LLVMPIPE-ON%%lib/libXvMCr600.so
269 %%LLVMPIPE-ON%%lib/dri/
270  r600_dri.so
271  r600_drv_video.so
272  radeonsi_dri.so
273  radeonsi_drv_video.so
274 %%LLVMPIPE-ON%%lib/vdpau/
275  libvdpau_r600.so
276  libvdpau_r600.so.1
277  libvdpau_r600.so.1.0
278  libvdpau_r600.so.1.0.0
279  libvdpau_radeonsi.so
280  libvdpau_radeonsi.so.1
281  libvdpau_radeonsi.so.1.0
282  libvdpau_radeonsi.so.1.0.0
283 %%X86_DRIVERS-ON%%lib/dri/
284  i915_dri.so
285  i965_dri.so
286  r200_dri.so
287  r300_dri.so
288  radeon_dri.so
289  vmwgfx_dri.so
290 %%X86_DRIVERS-ON%%lib/vdpau/
291  libvdpau_r300.so
292  libvdpau_r300.so.1
293  libvdpau_r300.so.1.0
294  libvdpau_r300.so.1.0.0
295 include/GL/internal/dri_interface.h
296 lib/dri/
297  kms_swrast_dri.so
298  swrast_dri.so
299 lib/pkgconfig/dri.pc
300 share/drirc.d/00-mesa-defaults.conf
301
302
303 [FILE:511:patches/patch-include_GL_internal_dri__interface.h]
304 GCC on 9.x doesn't allow types to be overwritten, these types are defined
305 in drm.h also, which causes build issues in xorg-server.
306
307 --- include/GL/internal/dri_interface.h.orig    2019-11-22 00:06:57 UTC
308 +++ include/GL/internal/dri_interface.h
309 @@ -40,13 +40,7 @@
310  #ifndef DRI_INTERFACE_H
311  #define DRI_INTERFACE_H
312  
313 -#ifdef HAVE_LIBDRM
314  #include <drm.h>
315 -#else
316 -typedef unsigned int drm_context_t;
317 -typedef unsigned int drm_drawable_t;
318 -typedef struct drm_clip_rect drm_clip_rect_t;
319 -#endif
320  
321  #include <GL/gl.h>
322  
323
324
325 [FILE:629:patches/patch-src_amd_common_ac__debug.c]
326 --- src/amd/common/ac_debug.c.orig      2019-11-22 00:06:57 UTC
327 +++ src/amd/common/ac_debug.c
328 @@ -573,6 +573,10 @@ void ac_parse_ib_chunk(FILE *f, uint32_t
329                        unsigned trace_id_count, enum chip_class chip_class,
330                         ac_debug_addr_callback addr_callback, void *addr_callback_data)
331  {
332 +#ifdef __sun__
333 +       printf("\nac_parse_ib_chunk: open_memstream unsupported on solaris");
334 +       exit (1);
335 +#else
336         struct ac_ib_parser ib = {};
337         ib.ib = ib_ptr;
338         ib.num_dw = num_dw;
339 @@ -598,6 +602,7 @@ void ac_parse_ib_chunk(FILE *f, uint32_t
340                 printf("\nPacket ends after the end of IB.\n");
341                 exit(1);
342         }
343 +#endif
344  }
345  
346  /**
347
348
349 [FILE:485:patches/patch-src_amd_vulkan_radv__device.c]
350 - Define CLOCK_MONOTONIC_RAW if missing
351
352 --- src/amd/vulkan/radv_device.c.orig   2019-11-22 00:06:57 UTC
353 +++ src/amd/vulkan/radv_device.c
354 @@ -49,6 +49,14 @@
355  #include "compiler/glsl_types.h"
356  #include "util/xmlpool.h"
357  
358 +#ifndef CLOCK_MONOTONIC_RAW
359 +# ifdef CLOCK_MONOTONIC_FAST
360 +#  define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST
361 +# else
362 +#  define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
363 +# endif
364 +#endif
365 +
366  static int
367  radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
368  {
369
370
371 [FILE:321:patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c]
372 - Define ETIME if missing
373
374 --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c.orig  2019-11-22 00:06:57 UTC
375 +++ src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
376 @@ -35,6 +35,9 @@
377  #include "radv_amdgpu_bo.h"
378  #include "sid.h"
379  
380 +#ifndef ETIME
381 +#define ETIME ETIMEDOUT
382 +#endif
383  
384  enum {
385         VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
386
387
388 [FILE:784:patches/patch-src_compiler_glsl_linker.cpp]
389 --- src/compiler/glsl/linker.cpp.orig   2019-11-22 00:06:57 UTC
390 +++ src/compiler/glsl/linker.cpp
391 @@ -91,6 +91,38 @@
392  #include "main/enums.h"
393  #include "main/mtypes.h"
394  
395 +#ifdef __sun__
396 +/* uses libbsd4sol prototypes, so can't be static */
397 +#include <stdlib.h>
398 +#include <stdint.h>
399 +#include <string.h>
400 +
401 +size_t
402 +strnlen(const char *s, size_t maxlen)
403 +{
404 +       size_t len;
405 +       for (len = 0; len < maxlen; len++, s++) {
406 +               if (!*s) break;
407 +       }
408 +       return (len);
409 +}
410 +
411 +char *
412 +strndup(const char *str, size_t n)
413 +{
414 +    size_t len;
415 +    char *copy;
416 +
417 +    len = strlen(str);
418 +    if (len <= n)
419 +        return strdup(str);
420 +    if ((copy = (char *)malloc(len + 1)) == NULL)
421 +        return (NULL);
422 +    memcpy(copy, str, len);
423 +    copy[len] = '\0';
424 +    return (copy);
425 +}
426 +#endif
427  
428  namespace {
429  
430
431
432 [FILE:586:patches/patch-src_egl_drivers_dri2_platform__x11.c]
433 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
434 #
435 --- src/egl/drivers/dri2/platform_x11.c.orig    2019-11-22 00:06:57 UTC
436 +++ src/egl/drivers/dri2/platform_x11.c
437 @@ -1539,6 +1539,9 @@ dri2_initialize_x11(_EGLDriver *drv, _EG
438  
439     if (!disp->Options.ForceSoftware) {
440  #ifdef HAVE_DRI3
441 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
442 +      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
443 +#endif
444        if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
445           initialized = dri2_initialize_x11_dri3(drv, disp);
446  #endif
447
448
449 [FILE:3256:patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c]
450 Revert the following commit.
451
452 FreeBSD and DragonFly don't have the required render nodes.
453
454 -------
455
456 From 69a1b9959e59653da262185c4e2cf57d24939b19 Mon Sep 17 00:00:00 2001
457 From: Emil Velikov <emil.l.velikov@gmail.com>
458 Date: Mon, 29 Jun 2015 12:36:45 +0100
459 Subject: pipe-loader: drop support for non-render node devices
460
461 Render nodes have been around for quite some time. Removing support via
462 the master/primary node allows us to clean up the conditional
463 compilation and simplify the build greatly.
464
465 For example currently we the pipe-loader, which explicitly links against
466 xcb and friends (for X auth) if found at compile-time. That
467 would cause problems as one will be forced to use X/xcb, even if it's a
468 headless system that is used for opencl.
469
470 v2: Clarify the linking topic in the commit message.
471
472 Cc: Tom Stellard <thomas.stellard@amd.com>
473 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
474 Reviewed-by: Francisco Jerez <currojerez@riseup.net>
475
476
477 --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig    2019-11-22 00:06:57 UTC
478 +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
479 @@ -241,6 +241,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa
480  }
481  
482  static int
483 +open_drm_minor(int minor)
484 +{
485 +   char path[PATH_MAX];
486 +   snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor);
487 +   return open(path, O_RDWR, 0);
488 +}
489 +
490 +static int
491  open_drm_render_node_minor(int minor)
492  {
493     char path[PATH_MAX];
494 @@ -252,8 +260,15 @@ open_drm_render_node_minor(int minor)
495  int
496  pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
497  {
498 -   int i, j, fd;
499 +   int i, k, fd, num_render_node_devs;
500 +   int j = 0;
501 +
502 +   struct {
503 +      unsigned vendor_id;
504 +      unsigned chip_id;
505 +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
506  
507 +   /* Look for render nodes first */
508     for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
509          i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
510        struct pipe_loader_device *dev;
511 @@ -267,6 +282,9 @@ pipe_loader_drm_probe(struct pipe_loader
512           continue;
513        }
514  
515 +      render_node_devs[j].vendor_id = dev->u.pci.vendor_id;
516 +      render_node_devs[j].chip_id = dev->u.pci.chip_id;
517 +
518        if (j < ndev) {
519           devs[j] = dev;
520        } else {
521 @@ -276,6 +294,46 @@ pipe_loader_drm_probe(struct pipe_loader
522        j++;
523     }
524  
525 +   num_render_node_devs = j;
526 +
527 +   /* Next look for drm devices. */
528 +   for (i = 0; i < DRM_MAX_MINOR; i++) {
529 +      struct pipe_loader_device *dev;
530 +      boolean duplicate = FALSE;
531 +      fd = open_drm_minor(i);
532 +      if (fd < 0)
533 +         continue;
534 +
535 +      if (!pipe_loader_drm_probe_fd(&dev, fd)) {
536 +         close(fd);
537 +         continue;
538 +      }
539 +
540 +      /* Check to make sure we aren't already accessing this device via
541 +       * render nodes.
542 +       */
543 +      for (k = 0; k < num_render_node_devs; k++) {
544 +         if (dev->u.pci.vendor_id == render_node_devs[k].vendor_id &&
545 +             dev->u.pci.chip_id == render_node_devs[k].chip_id) {
546 +            close(fd);
547 +            dev->ops->release(&dev);
548 +            duplicate = TRUE;
549 +            break;
550 +         }
551 +      }
552 +
553 +      if (duplicate)
554 +         continue;
555 +
556 +      if (j < ndev) {
557 +         devs[j] = dev;
558 +      } else {
559 +         dev->ops->release(&dev);
560 +      }
561 +
562 +      j++;
563 +   }
564 +
565     return j;
566  }
567  
568
569
570 [FILE:271:patches/patch-src_gallium_auxiliary_rbug_rbug__texture.c]
571 --- src/gallium/auxiliary/rbug/rbug_texture.c.orig      2019-11-22 00:06:57 UTC
572 +++ src/gallium/auxiliary/rbug/rbug_texture.c
573 @@ -36,6 +36,10 @@
574  
575  #include "c99_alloca.h"
576  
577 +#ifdef __sun
578 +#include <alloca.h>
579 +#endif
580 +
581  #include "rbug_internal.h"
582  #include "rbug_texture.h"
583  
584
585
586 [FILE:326:patches/patch-src_gallium_auxiliary_renderonly_renderonly.c]
587 --- src/gallium/auxiliary/renderonly/renderonly.c.orig  2019-11-22 00:06:57 UTC
588 +++ src/gallium/auxiliary/renderonly/renderonly.c
589 @@ -37,6 +37,10 @@
590  #include "util/u_inlines.h"
591  #include "util/u_memory.h"
592  
593 +#ifndef O_CLOEXEC
594 +#define O_CLOEXEC      0
595 +#endif
596 +
597  struct renderonly *
598  renderonly_dup(const struct renderonly *ro)
599  {
600
601
602 [FILE:6358:patches/patch-src_gallium_auxiliary_util_u__format__rgtc.c]
603 --- src/gallium/auxiliary/util/u_format_rgtc.c.orig     2019-11-22 00:06:57 UTC
604 +++ src/gallium/auxiliary/util/u_format_rgtc.c
605 @@ -175,13 +175,13 @@ util_format_rgtc1_snorm_pack_rgba_float(
606     for(y = 0; y < height; y += bh) {
607        int8_t *dst = (int8_t *)dst_row;
608        for(x = 0; x < width; x += bw) {
609 -         int8_t tmp[4][4];  /* [bh][bw][comps] */
610 +         signed char tmp[4][4];  /* [bh][bw][comps] */
611           for(j = 0; j < bh; ++j) {
612              for(i = 0; i < bw; ++i) {
613 -              tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
614 +              tmp[j][i] = (signed char)float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
615              }
616           }
617 -         util_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
618 +         util_format_signed_encode_rgtc_ubyte((signed char *)dst, tmp, 4, 4);
619           dst += bytes_per_block;
620        }
621        dst_row += dst_stride / sizeof(*dst_row);
622 @@ -194,14 +194,14 @@ util_format_rgtc1_snorm_unpack_rgba_floa
623     unsigned x, y, i, j;
624     int block_size = 8;
625     for(y = 0; y < height; y += 4) {
626 -      const int8_t *src = (int8_t *)src_row;
627 +      const signed char *src = (signed char *)src_row;
628        for(x = 0; x < width; x += 4) {
629           for(j = 0; j < 4; ++j) {
630              for(i = 0; i < 4; ++i) {
631                 float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
632 -               int8_t tmp_r;
633 +               signed char tmp_r;
634                 util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
635 -               dst[0] = byte_to_float_tex(tmp_r);
636 +               dst[0] = byte_to_float_tex((int8_t)tmp_r);
637                 dst[1] = 0.0;
638                 dst[2] = 0.0;
639                 dst[3] = 1.0;
640 @@ -216,9 +216,9 @@ util_format_rgtc1_snorm_unpack_rgba_floa
641  void
642  util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
643  {
644 -   int8_t tmp_r;
645 -   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
646 -   dst[0] = byte_to_float_tex(tmp_r);
647 +   signed char tmp_r;
648 +   util_format_signed_fetch_texel_rgtc(0, (signed char *)src, i, j, &tmp_r, 1);
649 +   dst[0] = byte_to_float_tex((int8_t)tmp_r);
650     dst[1] = 0.0;
651     dst[2] = 0.0;
652     dst[3] = 1.0;
653 @@ -268,16 +268,16 @@ util_format_rgtc2_unorm_pack_rgba_8unorm
654     for(y = 0; y < height; y += bh) {
655        uint8_t *dst = dst_row;
656        for(x = 0; x < width; x += bw) {
657 -         uint8_t tmp_r[4][4];  /* [bh][bw] */
658 -         uint8_t tmp_g[4][4];  /* [bh][bw] */
659 +         unsigned char tmp_r[4][4];  /* [bh][bw] */
660 +         unsigned char tmp_g[4][4];  /* [bh][bw] */
661           for(j = 0; j < bh; ++j) {
662              for(i = 0; i < bw; ++i) {
663 -              tmp_r[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
664 -              tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
665 +              tmp_r[j][i] = (unsigned char)src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
666 +              tmp_g[j][i] = (unsigned char)src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
667              }
668           }
669 -         util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
670 -         util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
671 +         util_format_unsigned_encode_rgtc_ubyte((unsigned char *)dst, tmp_r, 4, 4);
672 +         util_format_unsigned_encode_rgtc_ubyte((unsigned char *)(dst + 8), tmp_g, 4, 4);
673           dst += bytes_per_block;
674        }
675        dst_row += dst_stride / sizeof(*dst_row);
676 @@ -383,16 +383,16 @@ util_format_rgtc2_snorm_unpack_rgba_floa
677     unsigned x, y, i, j;
678     int block_size = 16;
679     for(y = 0; y < height; y += 4) {
680 -      const int8_t *src = (int8_t *)src_row;
681 +      const signed char *src = (signed char *)src_row;
682        for(x = 0; x < width; x += 4) {
683           for(j = 0; j < 4; ++j) {
684              for(i = 0; i < 4; ++i) {
685                 float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
686 -               int8_t tmp_r, tmp_g;
687 +               signed char tmp_r, tmp_g;
688                 util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
689                 util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
690 -               dst[0] = byte_to_float_tex(tmp_r);
691 -               dst[1] = byte_to_float_tex(tmp_g);
692 +               dst[0] = byte_to_float_tex((int8_t)tmp_r);
693 +               dst[1] = byte_to_float_tex((int8_t)tmp_g);
694                 dst[2] = 0.0;
695                 dst[3] = 1.0;
696              }
697 @@ -410,14 +410,14 @@ util_format_rxtc2_snorm_pack_rgba_float(
698     unsigned x, y, i, j;
699  
700     for(y = 0; y < height; y += bh) {
701 -      int8_t *dst = (int8_t *)dst_row;
702 +      signed char *dst = (signed char *)dst_row;
703        for(x = 0; x < width; x += bw) {
704 -         int8_t tmp_r[4][4];  /* [bh][bw][comps] */
705 -         int8_t tmp_g[4][4];  /* [bh][bw][comps] */
706 +         signed char tmp_r[4][4];  /* [bh][bw][comps] */
707 +         signed char tmp_g[4][4];  /* [bh][bw][comps] */
708           for(j = 0; j < bh; ++j) {
709              for(i = 0; i < bw; ++i) {
710 -              tmp_r[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
711 -               tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
712 +              tmp_r[j][i] = (signed char)float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
713 +              tmp_g[j][i] = (signed char)float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
714              }
715           }
716           util_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
717 @@ -437,11 +437,11 @@ util_format_rgtc2_snorm_pack_rgba_float(
718  void
719  util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
720  {
721 -   int8_t tmp_r, tmp_g;
722 -   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
723 -   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
724 -   dst[0] = byte_to_float_tex(tmp_r);
725 -   dst[1] = byte_to_float_tex(tmp_g);
726 +   signed char tmp_r, tmp_g;
727 +   util_format_signed_fetch_texel_rgtc(0, (signed char *)src, i, j, &tmp_r, 2);
728 +   util_format_signed_fetch_texel_rgtc(0, (signed char *)src + 8, i, j, &tmp_g, 2);
729 +   dst[0] = byte_to_float_tex((int8_t)tmp_r);
730 +   dst[1] = byte_to_float_tex((int8_t)tmp_g);
731     dst[2] = 0.0;
732     dst[3] = 1.0;
733  }
734
735
736 [FILE:338:patches/patch-src_gallium_drivers_radeonsi_si__shader.c]
737 --- src/gallium/drivers/radeonsi/si_shader.c.orig       2019-11-22 00:06:57 UTC
738 +++ src/gallium/drivers/radeonsi/si_shader.c
739 @@ -22,6 +22,10 @@
740   * USE OR OTHER DEALINGS IN THE SOFTWARE.
741   */
742  
743 +#ifdef __sun__
744 +#include <alloca.h> /* for alloca */
745 +#endif
746 +
747  #include "util/u_memory.h"
748  #include "util/u_string.h"
749  #include "tgsi/tgsi_build.h"
750
751
752 [FILE:511:patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c]
753 --- src/gallium/drivers/radeonsi/si_state_shaders.c.orig        2019-11-22 00:06:57 UTC
754 +++ src/gallium/drivers/radeonsi/si_state_shaders.c
755 @@ -2112,6 +2112,7 @@ static void si_build_shader_variant(stru
756                 return;
757         }
758  
759 +#ifndef __sun__
760         if (shader->compiler_ctx_state.is_debug_context) {
761                 FILE *f = open_memstream(&shader->shader_log,
762                                          &shader->shader_log_size);
763 @@ -2120,6 +2121,7 @@ static void si_build_shader_variant(stru
764                         fclose(f);
765                 }
766         }
767 +#endif
768  
769         si_shader_init_pm4_state(sscreen, shader);
770  }
771
772
773 [FILE:360:patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c]
774 # define ETIME as ETIMEOUT same as in intel driver
775 #
776 --- src/gallium/drivers/vc4/vc4_bufmgr.c.orig   2019-11-22 00:06:57 UTC
777 +++ src/gallium/drivers/vc4/vc4_bufmgr.c
778 @@ -27,6 +27,9 @@
779  #include <fcntl.h>
780  #include <xf86drm.h>
781  #include <xf86drmMode.h>
782 +#ifndef ETIME
783 +#define ETIME ETIMEDOUT
784 +#endif
785  
786  #include "util/u_hash_table.h"
787  #include "util/u_memory.h"
788
789
790 [FILE:1604:patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp]
791 # fix errors like the following
792 #
793 # llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str()
794  const'
795 # /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas
796 ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC
797 # /usr/bin/ld: final link failed: Bad value
798 #
799 --- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig  2019-11-22 00:06:57 UTC
800 +++ src/gallium/state_trackers/clover/llvm/invocation.cpp
801 @@ -181,6 +181,8 @@ namespace {
802        return get_lang_standard_from_version_str(device_version);
803     }
804  
805 +   const char* cstr(const std::string& str) { return str.c_str(); }
806 +
807     std::unique_ptr<clang::CompilerInstance>
808     create_compiler_instance(const device &dev,
809                              const std::vector<std::string> &opts,
810 @@ -193,8 +195,8 @@ namespace {
811        // Parse the compiler options.  A file name should be present at the end
812        // and must have the .cl extension in order for the CompilerInvocation
813        // class to recognize it as an OpenCL source file.
814 -      const std::vector<const char *> copts =
815 -         map(std::mem_fn(&std::string::c_str), opts);
816 +      std::vector<const char *> copts(opts.size());
817 +      std::transform(opts.begin(), opts.end(), copts.begin(), cstr);
818  
819        const target &target = dev.ir_target();
820        const std::string &device_clc_version = dev.device_clc_version();
821
822
823 [FILE:635:patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp]
824 # Fix error: no matching constructor for initialization of 'std::vector<const ::llvm::MDNode *>' 
825 #
826 --- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig    2019-11-22 00:06:57 UTC
827 +++ src/gallium/state_trackers/clover/llvm/metadata.hpp
828 @@ -42,7 +42,7 @@ namespace clover {
829           get_kernel_nodes(const ::llvm::Module &mod) {
830              if (const ::llvm::NamedMDNode *n =
831                     mod.getNamedMetadata("opencl.kernels"))
832 -               return { n->op_begin(), n->op_end() };
833 +               return { n->getOperand(0), n->getOperand(n->getNumOperands()) };
834              else
835                 return {};
836           }
837
838
839 [FILE:1150:patches/patch-src_gallium_state__trackers_clover_util_range.hpp]
840 From b95533b981af9a6687b41418e7cc2a5652fc2bdb Mon Sep 17 00:00:00 2001
841 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
842 Date: Fri, 7 Mar 2014 15:16:08 +0100
843 Subject: [PATCH 3/3] Work around for clang 3.4 which fails to build Clover
844
845 See:
846   https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3
847 --- src/gallium/state_trackers/clover/util/range.hpp.orig       2019-11-22 00:06:57 UTC
848 +++ src/gallium/state_trackers/clover/util/range.hpp
849 @@ -362,6 +362,12 @@ namespace clover {
850        return { i, i + n };
851     }
852  
853 +   namespace detail {
854 +      template<typename T>
855 +      using fixup_function_type =
856 +         typename std::conditional<std::is_function<T>::value, T &, T>::type;
857 +   }
858 +
859     ///
860     /// Create a range by transforming the contents of a number of
861     /// source ranges \a rs element-wise using a provided functor \a f.
862 @@ -369,7 +375,7 @@ namespace clover {
863     /// \sa adaptor_range.
864     ///
865     template<typename F, typename... Rs>
866 -   adaptor_range<F, Rs...>
867 +   adaptor_range<detail::fixup_function_type<F>, Rs...>
868     map(F &&f, Rs &&... rs) {
869        return { std::forward<F>(f), std::forward<Rs>(rs)... };
870     }
871
872
873 [FILE:816:patches/patch-src_gallium_targets_dri_meson.build]
874 --- src/gallium/targets/dri/meson.build.orig    2019-11-22 00:06:57 UTC
875 +++ src/gallium/targets/dri/meson.build
876 @@ -46,11 +46,12 @@ libgallium_dri = shared_library(
877    ],
878    c_args : [c_vis_args],
879    cpp_args : [cpp_vis_args],
880 -  link_args : [ld_args_build_id, ld_args_gc_sections, gallium_dri_ld_args],
881 +  link_args : [ld_args_gc_sections, gallium_dri_ld_args],
882    link_depends : gallium_dri_link_depends,
883 +  link_whole : [libdricommon, libgallium, libr300, libdri, libnir],
884    link_with : [
885 -    libmesa_gallium, libdricommon, libmegadriver_stub, libdri, libgalliumvl,
886 -    libgallium, libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
887 +    libmesa_gallium, libmegadriver_stub, libgalliumvl,
888 +    libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
889      libswkmsdri,
890    ],
891    dependencies : [
892
893
894 [FILE:572:patches/patch-src_gallium_targets_osmesa_meson.build]
895 --- src/gallium/targets/osmesa/meson.build.orig 2019-11-22 00:06:57 UTC
896 +++ src/gallium/targets/osmesa/meson.build
897 @@ -43,9 +43,9 @@ libosmesa = shared_library(
898      inc_gallium_drivers,
899    ],
900    link_depends : osmesa_link_deps,
901 -  link_whole : [libosmesa_st, libglapi_static],
902 +  link_whole : [libosmesa_st, libglapi_static, libsoftpipe, libgallium, libnir],
903    link_with : [
904 -    libmesa_gallium, libgallium, libws_null, osmesa_link_with,
905 +    libmesa_gallium, libws_null, osmesa_link_with,
906    ],
907    dependencies : [
908      dep_selinux, dep_thread, dep_clock, dep_unwind,
909
910
911 [FILE:613:patches/patch-src_gallium_targets_vdpau_meson.build]
912 --- src/gallium/targets/vdpau/meson.build.orig  2019-11-22 00:06:57 UTC
913 +++ src/gallium/targets/vdpau/meson.build
914 @@ -45,10 +45,10 @@ libvdpau_gallium = shared_library(
915    include_directories : [
916      inc_common, inc_util, inc_gallium_winsys, inc_gallium_drivers,
917    ],
918 -  link_whole : [libvdpau_st],
919 +  link_whole : [libvdpau_st, libr300, libradeonwinsys, libpipe_loader_static],
920    link_with : [
921      libgalliumvlwinsys, libgalliumvl, libgallium,
922 -    libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri,
923 +    libws_null, libwsw, libswdri, libswkmsdri,
924    ],
925    dependencies : [
926      idep_mesautil,
927
928
929 [FILE:558:patches/patch-src_gallium_targets_xa_meson.build]
930 --- src/gallium/targets/xa/meson.build.orig     2019-11-22 00:06:57 UTC
931 +++ src/gallium/targets/xa/meson.build
932 @@ -41,9 +41,9 @@ libxatracker = shared_library(
933    include_directories : [
934      inc_common, inc_util, inc_gallium_winsys, inc_gallium_drivers,
935    ],
936 -  link_whole : [libxa_st],
937 +  link_whole : [libxa_st, libsvga, libsvgadrm, libpipe_loader_static],
938    link_with : [
939 -    libgalliumvl_stub, libgallium, libpipe_loader_static,
940 +    libgalliumvl_stub, libgallium,
941      libws_null, libwsw, libswdri, libswkmsdri,
942    ],
943    link_depends : xa_link_depends,
944
945
946 [FILE:324:patches/patch-src_gallium_winsys_amdgpu_drm_amdgpu__cs.c]
947 --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c.orig      2019-11-22 00:06:58 UTC
948 +++ src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
949 @@ -33,6 +33,10 @@
950  
951  #include "amd/common/sid.h"
952  
953 +#ifdef __sun__
954 +#include <alloca.h>
955 +#endif
956 +
957  DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
958  
959  #ifndef AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID
960
961
962 [FILE:426:patches/patch-src_gbm_meson.build]
963 --- src/gbm/meson.build.orig    2019-11-22 00:06:58 UTC
964 +++ src/gbm/meson.build
965 @@ -50,7 +50,7 @@ libgbm = shared_library(
966    c_args : [c_vis_args, args_gbm],
967    link_args : [ld_args_gc_sections],
968    link_with : libloader,
969 -  dependencies : [deps_gbm, dep_dl, dep_thread, idep_mesautil, idep_xmlconfig],
970 +  dependencies : [deps_gbm, dep_dl, dep_thread, idep_xmlconfig, idep_mesautil],
971    version : '1.0.0',
972    install : true,
973  )
974
975
976 [FILE:575:patches/patch-src_glx_glxext.c]
977 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
978 #
979 --- src/glx/glxext.c.orig       2019-11-22 00:06:58 UTC
980 +++ src/glx/glxext.c
981 @@ -914,6 +914,9 @@ __glXInitialize(Display * dpy)
982  #if defined(GLX_USE_DRM)
983     if (glx_direct && glx_accel) {
984  #if defined(HAVE_DRI3)
985 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
986 +      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
987 +#endif
988        if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
989           dpyPriv->dri3Display = dri3_create_display(dpy);
990  #endif /* HAVE_DRI3 */
991
992
993 [FILE:318:patches/patch-src_glx_meson.build]
994 --- src/glx/meson.build.orig    2019-11-22 00:06:58 UTC
995 +++ src/glx/meson.build
996 @@ -149,7 +149,7 @@ libglx = static_library(
997      extra_libs_libglx,
998    ],
999    dependencies : [
1000 -    idep_mesautil, idep_xmlconfig,
1001 +    idep_xmlconfig, idep_mesautil,
1002      dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd,
1003    ],
1004  )
1005
1006
1007 [FILE:995:patches/patch-src_intel_compiler_brw__eu__validate.c]
1008 --- src/intel/compiler/brw_eu_validate.c.orig   2019-11-22 00:06:58 UTC
1009 +++ src/intel/compiler/brw_eu_validate.c
1010 @@ -40,6 +40,39 @@
1011  
1012  #include "brw_eu.h"
1013  
1014 +#ifdef __sun__
1015 +#include <string.h>
1016 +
1017 +static void *
1018 +memmem(const void *l, size_t l_len, const void *s, size_t s_len)
1019 +{
1020 +       char *cur, *last;
1021 +       const char *cl = (const char *)l;
1022 +       const char *cs = (const char *)s;
1023 +
1024 +       /* we need something to compare */
1025 +       if (l_len == 0 || s_len == 0)
1026 +               return NULL;
1027 +
1028 +       /* "s" must be smaller or equal to "l" */
1029 +       if (l_len < s_len)
1030 +               return NULL;
1031 +
1032 +       /* special case where s_len == 1 */
1033 +       if (s_len == 1)
1034 +               return memchr(l, (int)*cs, l_len);
1035 +
1036 +       /* the last position where its possible to find "s" in "l" */
1037 +       last = (char *)cl + l_len - s_len;
1038 +
1039 +       for (cur = (char *)cl; cur <= last; cur++)
1040 +               if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
1041 +                       return cur;
1042 +
1043 +       return NULL;
1044 +}
1045 +#endif
1046 +
1047  /* We're going to do lots of string concatenation, so this should help. */
1048  struct string {
1049     char *str;
1050
1051
1052 [FILE:954:patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp]
1053 --- src/intel/compiler/brw_fs_bank_conflicts.cpp.orig   2019-11-22 00:06:58 UTC
1054 +++ src/intel/compiler/brw_fs_bank_conflicts.cpp
1055 @@ -309,8 +309,13 @@ namespace {
1056           const unsigned align = MAX2(sizeof(void *), __alignof__(vector_type));
1057           const unsigned size = DIV_ROUND_UP(n, vector_width) * sizeof(vector_type);
1058           void *p;
1059 +#ifdef __sun
1060 +       p = memalign(align, size);
1061 +       if (p == NULL) return NULL;
1062 +#else
1063           if (posix_memalign(&p, align, size))
1064              return NULL;
1065 +#endif
1066           memset(p, 0, size);
1067           return reinterpret_cast<vector_type *>(p);
1068        }
1069 @@ -728,7 +733,7 @@ namespace {
1070                     const weight_vector_type &conflicts)
1071     {
1072        const unsigned m = DIV_ROUND_UP(conflicts.size, vector_width);
1073 -      vector_type s_p = {}, s_n = {};
1074 +      vector_type s_p = {0}, s_n = {0};
1075  
1076        for (unsigned r = 0; r < m; r++) {
1077           s_p = adds(s_p, mask(bank_mask_p.v[r], conflicts.v[r]));
1078
1079
1080 [FILE:225:patches/patch-src_intel_isl_isl.h]
1081 --- src/intel/isl/isl.h.orig    2019-11-22 00:06:58 UTC
1082 +++ src/intel/isl/isl.h
1083 @@ -46,6 +46,9 @@
1084  #include "util/macros.h"
1085  
1086  #ifdef __cplusplus
1087 +# ifdef __sun__
1088 +# define restrict      __restrict__
1089 +# endif
1090  extern "C" {
1091  #endif
1092  
1093
1094
1095 [FILE:1594:patches/patch-src_intel_perf_gen__perf.c]
1096 $NetBSD: patch-src_intel_perf_gen__perf.c,v 1.1 2019/08/24 20:11:19 nia Exp $
1097
1098 SunOS does not have d_type in DIR structure.
1099
1100 --- src/intel/perf/gen_perf.c.orig      2019-11-22 00:06:58 UTC
1101 +++ src/intel/perf/gen_perf.c
1102 @@ -394,6 +394,9 @@ get_sysfs_dev_dir(struct gen_perf_config
1103     DIR *drmdir;
1104     struct dirent *drm_entry;
1105     int len;
1106 +#ifdef __sun
1107 +   struct stat s;
1108 +#endif
1109  
1110     perf->sysfs_dev_dir[0] = '\0';
1111  
1112 @@ -425,8 +428,14 @@ get_sysfs_dev_dir(struct gen_perf_config
1113     }
1114  
1115     while ((drm_entry = readdir(drmdir))) {
1116 +#ifdef __sun
1117 +      stat(drm_entry->d_name, &s);
1118 +      if ((s.st_mode == S_IFDIR ||
1119 +           s.st_mode == S_IFLNK) &&
1120 +#else
1121        if ((drm_entry->d_type == DT_DIR ||
1122             drm_entry->d_type == DT_LNK) &&
1123 +#endif
1124            strncmp(drm_entry->d_name, "card", 4) == 0)
1125        {
1126           len = snprintf(perf->sysfs_dev_dir,
1127 @@ -527,6 +536,9 @@ enumerate_sysfs_metrics(struct gen_perf_
1128     struct dirent *metric_entry;
1129     char buf[256];
1130     int len;
1131 +#ifdef __sun
1132 +   struct stat s;
1133 +#endif
1134  
1135     len = snprintf(buf, sizeof(buf), "%s/metrics", perf->sysfs_dev_dir);
1136     if (len < 0 || len >= sizeof(buf)) {
1137 @@ -543,8 +555,14 @@ enumerate_sysfs_metrics(struct gen_perf_
1138     while ((metric_entry = readdir(metricsdir))) {
1139        struct hash_entry *entry;
1140  
1141 +#ifdef __sun
1142 +      stat(metric_entry->d_name, &s);
1143 +      if ((s.st_mode != S_IFDIR &&
1144 +           s.st_mode != S_IFLNK) ||
1145 +#else
1146        if ((metric_entry->d_type != DT_DIR &&
1147             metric_entry->d_type != DT_LNK) ||
1148 +#endif
1149            metric_entry->d_name[0] == '.')
1150           continue;
1151  
1152
1153
1154 [FILE:302:patches/patch-src_intel_tools_aubinator__error__decode.c]
1155 # expose getline in FreeBSD's stdio.h
1156 #
1157 --- src/intel/tools/aubinator_error_decode.c.orig       2019-11-22 00:06:58 UTC
1158 +++ src/intel/tools/aubinator_error_decode.c
1159 @@ -22,6 +22,9 @@
1160   *
1161   */
1162  
1163 +#ifdef __FreeBSD__
1164 +#define _WITH_GETLINE
1165 +#endif
1166  #include <stdbool.h>
1167  #include <stdio.h>
1168  #include <stdlib.h>
1169
1170
1171 [FILE:238:patches/patch-src_intel_tools_error2aub.c]
1172 --- src/intel/tools/error2aub.c.orig    2019-11-22 00:06:58 UTC
1173 +++ src/intel/tools/error2aub.c
1174 @@ -22,6 +22,9 @@
1175   *
1176   */
1177  
1178 +#ifdef __FreeBSD__
1179 +#define _WITH_GETLINE
1180 +#endif
1181  #include <assert.h>
1182  #include <getopt.h>
1183  #include <inttypes.h>
1184
1185
1186 [FILE:1096:patches/patch-src_intel_vulkan_anv__device.c]
1187 - Without sysinfo() fall back to sysconf()
1188 - Define ETIME if missing
1189
1190 --- src/intel/vulkan/anv_device.c.orig  2019-11-22 00:06:58 UTC
1191 +++ src/intel/vulkan/anv_device.c
1192 @@ -25,7 +25,9 @@
1193  #include <stdbool.h>
1194  #include <string.h>
1195  #include <sys/mman.h>
1196 +#ifdef __GLIBC__
1197  #include <sys/sysinfo.h>
1198 +#endif
1199  #include <unistd.h>
1200  #include <fcntl.h>
1201  #include <xf86drm.h>
1202 @@ -60,6 +62,10 @@ DRI_CONF_END;
1203   */
1204  #define MAX_DEBUG_MESSAGE_LENGTH    4096
1205  
1206 +#ifndef ETIME
1207 +#define ETIME ETIMEDOUT
1208 +#endif
1209 +
1210  static void
1211  compiler_debug_log(void *data, const char *fmt, ...)
1212  {
1213 @@ -96,10 +102,15 @@ static uint64_t
1214  anv_compute_heap_size(int fd, uint64_t gtt_size)
1215  {
1216     /* Query the total ram from the system */
1217 +#ifdef __GLIBC__
1218     struct sysinfo info;
1219     sysinfo(&info);
1220  
1221     uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit;
1222 +#else
1223 +   uint64_t total_ram = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE);
1224 +#endif
1225 +
1226  
1227     /* We don't want to burn too much ram with the GPU.  If the user has 4GiB
1228      * or less, we use at most half.  If they have more than 4GiB, we use 3/4.
1229
1230
1231 [FILE:354:patches/patch-src_loader_loader.c]
1232 $NetBSD: patch-src_loader_loader.c,v 1.5 2019/08/29 14:12:57 nia Exp $
1233
1234 Include limits.h for PATH_MAX.
1235
1236 --- src/loader/loader.c.orig    2019-11-22 00:06:58 UTC
1237 +++ src/loader/loader.c
1238 @@ -36,6 +36,7 @@
1239  #include <string.h>
1240  #include <unistd.h>
1241  #include <stdlib.h>
1242 +#include <limits.h>
1243  #include <sys/param.h>
1244  #ifdef MAJOR_IN_MKDEV
1245  #include <sys/mkdev.h>
1246
1247
1248 [FILE:944:patches/patch-src_mesa_drivers_dri_i965_brw__bufmgr.c]
1249 --- src/mesa/drivers/dri/i965/brw_bufmgr.c.orig 2019-11-22 00:06:59 UTC
1250 +++ src/mesa/drivers/dri/i965/brw_bufmgr.c
1251 @@ -74,6 +74,10 @@
1252  #define VG(x)
1253  #endif
1254  
1255 +#ifndef O_CLOEXEC
1256 +#define O_CLOEXEC      0
1257 +#endif
1258 +
1259  /* VALGRIND_FREELIKE_BLOCK unfortunately does not actually undo the earlier
1260   * VALGRIND_MALLOCLIKE_BLOCK but instead leaves vg convinced the memory is
1261   * leaked. All because it does not call VG(cli_free) from its
1262 @@ -1723,8 +1727,12 @@ brw_bufmgr_init(struct gen_device_info *
1263        bufmgr->initial_kflags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
1264  
1265        /* Allocate VMA in userspace if we have softpin and full PPGTT. */
1266 +#ifdef __DragonFly__
1267 +      if (false) {
1268 +#else
1269        if (gem_param(fd, I915_PARAM_HAS_EXEC_SOFTPIN) > 0 &&
1270            gem_param(fd, I915_PARAM_HAS_ALIASING_PPGTT) > 1) {
1271 +#endif
1272           bufmgr->initial_kflags |= EXEC_OBJECT_PINNED;
1273  
1274           util_vma_heap_init(&bufmgr->vma_allocator[BRW_MEMZONE_LOW_4G],
1275
1276
1277 [FILE:710:patches/patch-src_mesa_drivers_dri_i965_brw__disk__cache.c]
1278 --- src/mesa/drivers/dri/i965/brw_disk_cache.c.orig     2019-11-22 00:06:59 UTC
1279 +++ src/mesa/drivers/dri/i965/brw_disk_cache.c
1280 @@ -394,6 +394,7 @@ brw_disk_cache_init(struct intel_screen
1281     if (INTEL_DEBUG & DEBUG_DISK_CACHE_DISABLE_MASK)
1282        return;
1283  
1284 +# ifdef HAVE_DL_ITERATE_PHDR
1285     /* array length: print length + null char + 1 extra to verify it is unused */
1286     char renderer[11];
1287     ASSERTED int len = snprintf(renderer, sizeof(renderer), "i965_%04x",
1288 @@ -413,5 +414,6 @@ brw_disk_cache_init(struct intel_screen
1289     const uint64_t driver_flags =
1290        brw_get_compiler_config_value(screen->compiler);
1291     screen->disk_cache = disk_cache_create(renderer, timestamp, driver_flags);
1292 +# endif
1293  #endif
1294  }
1295
1296
1297 [FILE:851:patches/patch-src_mesa_drivers_dri_i965_brw__program__binary.c]
1298 --- src/mesa/drivers/dri/i965/brw_program_binary.c.orig 2019-11-22 00:06:59 UTC
1299 +++ src/mesa/drivers/dri/i965/brw_program_binary.c
1300 @@ -36,9 +36,11 @@ static uint8_t driver_sha1[20];
1301  void
1302  brw_program_binary_init(unsigned device_id)
1303  {
1304 +#ifdef HAVE_DL_ITERATE_PHDR
1305     const struct build_id_note *note =
1306        build_id_find_nhdr_for_addr(brw_program_binary_init);
1307     assert(note);
1308 +#endif
1309  
1310     /**
1311      * With Mesa's megadrivers, taking the sha1 of i965_dri.so may not be
1312 @@ -52,7 +54,9 @@ brw_program_binary_init(unsigned device_
1313     int len = snprintf(renderer, sizeof(renderer), "i965_%04x", device_id);
1314     assert(len == sizeof(renderer) - 1);
1315     _mesa_sha1_update(&ctx, renderer, len);
1316 +#ifdef HAVE_DL_ITERATE_PHDR
1317     _mesa_sha1_update(&ctx, build_id_data(note), build_id_length(note));
1318 +#endif
1319     _mesa_sha1_final(&ctx, driver_sha1);
1320  }
1321  
1322
1323
1324 [FILE:1092:patches/patch-src_mesa_drivers_dri_i965_intel__batchbuffer.c]
1325 --- src/mesa/drivers/dri/i965/intel_batchbuffer.c.orig  2019-11-22 00:06:59 UTC
1326 +++ src/mesa/drivers/dri/i965/intel_batchbuffer.c
1327 @@ -67,7 +67,11 @@ dump_validation_list(struct intel_batchb
1328        uint64_t flags = batch->validation_list[i].flags;
1329        assert(batch->validation_list[i].handle ==
1330               batch->exec_bos[i]->gem_handle);
1331 +#ifdef __linux__
1332        fprintf(stderr, "[%2d]: %2d %-14s %p %s%-7s @ 0x%016llx%s (%"PRIu64"B)\n",
1333 +#else
1334 +      fprintf(stderr, "[%2d]: %2d %-14s %p %s%-7s @ 0x%016lx%s (%"PRIu64"B)\n",
1335 +#endif
1336                i,
1337                batch->validation_list[i].handle,
1338                batch->exec_bos[i]->name,
1339 @@ -721,7 +725,11 @@ execbuffer(int fd,
1340  
1341        /* Update brw_bo::gtt_offset */
1342        if (batch->validation_list[i].offset != bo->gtt_offset) {
1343 +#ifdef __linux__
1344           DBG("BO %d migrated: 0x%" PRIx64 " -> 0x%llx\n",
1345 +#else
1346 +         DBG("BO %d migrated: 0x%" PRIx64 " -> 0x%lx\n",
1347 +#endif
1348               bo->gem_handle, bo->gtt_offset,
1349               batch->validation_list[i].offset);
1350           assert(!(bo->kflags & EXEC_OBJECT_PINNED));
1351
1352
1353 [FILE:967:patches/patch-src_mesa_drivers_dri_meson.build]
1354 --- src/mesa/drivers/dri/meson.build.orig       2019-11-22 00:06:59 UTC
1355 +++ src/mesa/drivers/dri/meson.build
1356 @@ -20,7 +20,7 @@
1357  
1358  subdir('common')
1359  
1360 -_dri_drivers = []
1361 +_dri_drivers = [ libnir, libmesa_classic, libintel_compiler, libglcpp, libdricommon ]
1362  _dri_link = []
1363  if with_dri_swrast
1364    subdir('swrast')
1365 @@ -59,14 +59,13 @@ if _dri_drivers != []
1366      [],
1367      link_whole : _dri_drivers,
1368      link_with : [
1369 -      libmegadriver_stub, libdricommon, libglapi,
1370 -      libmesa_classic,
1371 +      libmegadriver_stub, libglapi,
1372      ],
1373      dependencies : [
1374        dep_selinux, dep_libdrm, dep_m, dep_thread, dep_dl,
1375 -      idep_nir, idep_xmlconfig, idep_mesautil,
1376 +      idep_xmlconfig, idep_mesautil,
1377      ],
1378 -    link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
1379 +    link_args : [ld_args_bsymbolic, ld_args_gc_sections],
1380      # Will be deleted during installation, see install_megadrivers.py
1381      install : true,
1382      install_dir : dri_drivers_path,
1383
1384
1385 [FILE:406:patches/patch-src_mesa_main_compiler.h]
1386 --- src/mesa/main/compiler.h.orig       2019-11-22 00:06:59 UTC
1387 +++ src/mesa/main/compiler.h
1388 @@ -51,6 +51,9 @@
1389  #if defined(__linux__)
1390  #include <byteswap.h>
1391  #define CPU_TO_LE32( x )       bswap_32( x )
1392 +#elif defined(__FreeBSD__)
1393 +#include <sys/endian.h>
1394 +#define CPU_TO_LE32( x )       bswap32( x )
1395  #elif defined(__APPLE__)
1396  #include <CoreFoundation/CFByteOrder.h>
1397  #define CPU_TO_LE32( x )       CFSwapInt32HostToLittle( x )
1398
1399
1400 [FILE:476:patches/patch-src_mesa_main_imports.c]
1401 --- src/mesa/main/imports.c.orig        2019-11-22 00:06:59 UTC
1402 +++ src/mesa/main/imports.c
1403 @@ -83,11 +83,15 @@ void *
1404  _mesa_align_malloc(size_t bytes, unsigned long alignment)
1405  {
1406  #if defined(HAVE_POSIX_MEMALIGN)
1407 +# ifdef __sun__
1408 +   return memalign(alignment, bytes);
1409 +# else
1410     void *mem;
1411     int err = posix_memalign(& mem, alignment, bytes);
1412     if (err)
1413        return NULL;
1414     return mem;
1415 +# endif
1416  #elif defined(_WIN32)
1417     return _aligned_malloc(bytes, alignment);
1418  #else
1419
1420
1421 [FILE:237:patches/patch-src_mesa_main_macros.h]
1422 --- src/mesa/main/macros.h.orig 2019-11-22 00:06:59 UTC
1423 +++ src/mesa/main/macros.h
1424 @@ -36,6 +36,7 @@
1425  #include "util/rounding.h"
1426  #include "imports.h"
1427  
1428 +#undef ALIGN
1429  
1430  /**
1431   * \name Integer / float conversion for colors, normals, etc.
1432
1433
1434 [FILE:227:patches/patch-src_mesa_main_marshal.h]
1435 --- src/mesa/main/marshal.h.orig        2019-11-22 00:06:59 UTC
1436 +++ src/mesa/main/marshal.h
1437 @@ -32,6 +32,7 @@
1438  
1439  #include "main/glthread.h"
1440  #include "main/context.h"
1441 +#undef ALIGN
1442  #include "main/macros.h"
1443  
1444  struct marshal_cmd_base
1445
1446
1447 [FILE:328:patches/patch-src_util_build__id.c]
1448 # Elf_ doesn't exist, use Elf32_ or Elf64_
1449 #
1450 --- src/util/build_id.c.orig    2019-11-22 00:06:59 UTC
1451 +++ src/util/build_id.c
1452 @@ -35,7 +35,11 @@
1453  #endif
1454  
1455  #ifndef ElfW
1456 -#define ElfW(type) Elf_##type
1457 +#ifdef __LP64__
1458 +#define ElfW(type) Elf64_##type
1459 +#else
1460 +#define ElfW(type) Elf32_##type
1461 +#endif
1462  #endif
1463  
1464  struct build_id_note {
1465
1466
1467 [FILE:282:patches/patch-src_util_disk__cache.c]
1468 --- src/util/disk_cache.c.orig  2019-11-22 00:06:59 UTC
1469 +++ src/util/disk_cache.c
1470 @@ -52,6 +52,10 @@
1471  
1472  #include "disk_cache.h"
1473  
1474 +#ifndef O_CLOEXEC
1475 +#define O_CLOEXEC      0
1476 +#endif
1477 +
1478  /* Number of bits to mask off from a cache key to get an index. */
1479  #define CACHE_INDEX_KEY_BITS 16
1480  
1481
1482
1483 [FILE:1482:patches/patch-src_util_futex.h]
1484 - Implement futex_wake() and futex_wait() via _umtx_op()
1485
1486 --- src/util/futex.h.orig       2019-11-22 00:06:59 UTC
1487 +++ src/util/futex.h
1488 @@ -29,10 +29,35 @@
1489  #include <limits.h>
1490  #include <stdint.h>
1491  #include <unistd.h>
1492 +#if defined(__FreeBSD__)
1493 +#include <errno.h>
1494 +# if __FreeBSD__ < 11
1495 +#  include <machine/atomic.h>
1496 +# endif
1497 +#include <sys/umtx.h>
1498 +#else
1499  #include <linux/futex.h>
1500  #include <sys/syscall.h>
1501 +#endif
1502  #include <sys/time.h>
1503  
1504 +#if defined(__FreeBSD__)
1505 +static inline int futex_wake(uint32_t *addr, int count)
1506 +{
1507 +   return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
1508 +}
1509 +
1510 +static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
1511 +{
1512 +   void *uaddr = NULL, *uaddr2 = NULL;
1513 +   if (timeout != NULL) {
1514 +      const struct _umtx_time tmo = { ._timeout = *timeout, ._flags = UMTX_ABSTIME, ._clockid = CLOCK_MONOTONIC };
1515 +      uaddr = (void *)(uintptr_t)sizeof(tmo);
1516 +      uaddr2 = (void *)&tmo;
1517 +   }
1518 +   return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == -1 ? errno : 0;
1519 +}
1520 +#else
1521  static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
1522  {
1523     return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
1524 @@ -50,6 +75,7 @@ static inline int futex_wait(uint32_t *a
1525     return sys_futex(addr, FUTEX_WAIT_BITSET, value, timeout, NULL,
1526                      FUTEX_BITSET_MATCH_ANY);
1527  }
1528 +#endif
1529  
1530  #elif defined(__FreeBSD__)
1531  
1532
1533
1534 [FILE:544:patches/patch-src_util_os__memory__stdc.h]
1535 --- src/util/os_memory_stdc.h.orig      2019-11-22 00:06:59 UTC
1536 +++ src/util/os_memory_stdc.h
1537 @@ -51,11 +51,16 @@
1538  static inline void *
1539  os_malloc_aligned(size_t size, size_t alignment)
1540  {
1541 +#ifdef __sun
1542 +   alignment = (alignment + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
1543 +   return memalign(alignment, size);
1544 +#else
1545     void *ptr;
1546     alignment = (alignment + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
1547     if(posix_memalign(&ptr, alignment, size) != 0)
1548        return NULL;
1549     return ptr;
1550 +#endif
1551  }
1552  
1553  #define os_free_aligned(_ptr) free(_ptr)
1554
1555
1556 [FILE:430:patches/patch-src_util_u__atomic.h]
1557 --- src/util/u_atomic.h.orig    2019-11-22 00:06:59 UTC
1558 +++ src/util/u_atomic.h
1559 @@ -20,11 +20,7 @@
1560   * locally coded assembly, compiler intrinsic or ultimately a
1561   * mutex-based implementation.
1562   */
1563 -#if defined(__sun)
1564 -#define PIPE_ATOMIC_OS_SOLARIS
1565 -#elif defined(_MSC_VER)
1566 -#define PIPE_ATOMIC_MSVC_INTRINSIC
1567 -#elif defined(__GNUC__)
1568 +#if defined(__GNUC__)
1569  #define PIPE_ATOMIC_GCC_INTRINSIC
1570  #else
1571  #error "Unsupported platform"
1572
1573
1574 [FILE:1026:patches/patch-src_util_u__thread.h]
1575 --- src/util/u_thread.h.orig    2019-11-22 00:06:59 UTC
1576 +++ src/util/u_thread.h
1577 @@ -69,16 +69,14 @@ static inline thrd_t u_thread_create(int
1578  static inline void u_thread_setname( const char *name )
1579  {
1580  #if defined(HAVE_PTHREAD)
1581 -#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS
1582 +#if DETECT_OS_LINUX || DETECT_OS_CYGWIN
1583     pthread_setname_np(pthread_self(), name);
1584 -#elif DETECT_OS_FREEBSD || DETECT_OS_OPENBSD
1585 +#elif DETECT_OS_FREEBSD || DETECT_OS_OPENBSD || DETECT_OS_DRAGONFLY
1586     pthread_set_name_np(pthread_self(), name);
1587  #elif DETECT_OS_NETBSD
1588     pthread_setname_np(pthread_self(), "%s", (void *)name);
1589  #elif DETECT_OS_APPLE
1590     pthread_setname_np(name);
1591 -#else
1592 -#error Not sure how to call pthread_setname_np
1593  #endif
1594  #endif
1595     (void)name;
1596 @@ -149,7 +147,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
1597  static inline int64_t
1598  u_thread_get_time_nano(thrd_t thread)
1599  {
1600 -#if defined(__linux__) && defined(HAVE_PTHREAD)
1601 +#if defined(HAVE_PTHREAD) && !defined(__sun)
1602     struct timespec ts;
1603     clockid_t cid;
1604  
1605
1606
1607 [FILE:87:files/special.mk]
1608 GALLIUM_DRIVERS+=       SWRAST
1609
1610 .if ${OPSYS:MSunOS}
1611 MESON_ARGS+=    -Dshader-cache=false
1612 .endif
1613