Ravenports generated: 16 Jan 2022 02:14
[ravenports.git] / bucket_F0 / mesa
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               mesa
4 VERSION=                21.3.4
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-21.3.4.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=          python-Mako:single:python_used
30                         libpthread-stubs:single:standard
31                         libelf:single:standard
32                         libvdpau:single:standard
33                         libva:single:standard
34 BUILDRUN_DEPENDS=       libdrm:single:standard
35 EXRUN[drivers]=         mesa:libs:standard
36                         libelf:single:standard
37
38 USES=                   cpe bison gettext-tools gmake meson pkgconfig zstd
39                         zlib expat shebangfix solaris-funcs python:build
40                         c++:libs,drivers
41 XORG_COMPONENTS=        x11 xdamage xext xfixes xshmfence xxf86vm xv xrandr
42                         xcb
43
44 LICENSE=                MIT:libs CUSTOM1:libs CUSTOM2:libs
45 LICENSE_NAME=           CUSTOM1:"Kronos License (MIT with modifications)"
46                         CUSTOM2:"SGI Free Software License B"
47 LICENSE_FILE=           MIT:{{WRKDIR}}/LICENSE_MIT
48                         CUSTOM1:{{WRKDIR}}/LICENSE_KHRONOS
49                         CUSTOM2:{{WRKDIR}}/LICENSE_SGI
50 LICENSE_AWK=            MIT:"^$$"
51                         CUSTOM2:"^$$"
52 LICENSE_SOURCE=         MIT:{{WRKSRC}}/include/GL/gl.h
53                         CUSTOM2:{{WRKSRC}}/src/glx/eval.c
54 LICENSE_SCHEME=         multi
55
56 CPE_VENDOR=             mesa3d
57 FPC_EQUIVALENT=         graphics/mesa-libs
58 MESON_ARGS=             -Dplatforms=x11{{WAYPLAT}}
59                         -Dzstd=enabled
60                         -Ddri3=true
61                         -Ddri-drivers={{DRI_DRIVERS:tW:tl:C/[[:space:]]/,/g}}
62                         -Dgallium-drivers={{GALLIUM_DRIVERS:tW:tl:C/[[:space:]]/,/g}}
63                         -Dgallium-vdpau=enabled
64                         -Dosmesa=true
65                         -Dlibunwind=false
66                         -Dgles1=disabled
67                         -Dvulkan-drivers={{VULKAN_DRIVERS:tW:tl:C/[[:space:]]/,/g}}
68 SHEBANG_FILES=          src/gallium/*/*/*.py
69                         src/gallium/tools/trace/*.py
70                         src/gallium/drivers/svga/svgadump/svga_dump.py
71                         src/mapi/glapi/gen/*.py
72                         src/mapi/mapi_abi.py
73                         src/mesa/main/get_*.py
74                         src/util/format_srgb.py
75                         src/amd/*/*.py
76                         src/intel/genxml/gen_pack_header.py
77 SHEBANG_OLD_PYTHON=     /usr/bin/env[[:space:]]python2
78                         /usr/bin/python2
79                         /bin/env[[:space:]]python
80 SOL_FUNCTIONS=          dirfd:src/util/disk_cache.c
81                         asprintf:src/util/anon_file.c
82                         asprintf:src/mesa/drivers/dri/common/megadriver_stub.c
83                         asprintf:src/loader/loader.c
84                         asprintf:src/egl/main/eglcurrent.c
85                         asprintf:src/util/u_string.h
86                         asprintf:src/amd/common/ac_rtld.c
87                         strnlen:src/util/ralloc.c
88                         strnlen:src/mesa/main/errors.c
89                         strndup:src/loader/loader.c
90                         strndup:src/egl/drivers/dri2/platform_x11.c
91                         strndup:src/gallium/drivers/r600/evergreen_compute.c
92                         strndup:src/gallium/drivers/radeonsi/si_debug.c
93
94 CONFIGURE_ENV=          ax_cv_check_cflags___Wno_initializer_overrides=no
95
96 INSTALL_TARGET=         install-strip
97 INSTALL_REQ_TOOLCHAIN=  yes
98
99 CFLAGS=                 -Wno-pointer-sign
100 VAR_OPSYS[sunos]=       CPPFLAGS=-D__EXTENSIONS__=1
101                         CPPFLAGS=-Wno-unused-function
102                         CXXFLAGS=-Drestrict=__restrict__
103                         CFLAGS=-D_POSIX_PTHREAD_SEMANTICS
104                         CFLAGS=-DF_DUPFD_CLOEXEC=F_DUPFD
105                         CFLAGS=-Wno-incompatible-pointer-types
106                         LDFLAGS=-lsocket
107                         LDFLAGS=-lnsl
108                         MAKEFILE_LINE=MESON_ARGS+=-Dshader-cache=false
109
110 [ARM_DRIVERS].DESCRIPTION=              Build drivers for aarch64 architecture
111 [ARM_DRIVERS].MAKEFILE_ON=              GALLIUM_DRIVERS+=FREEDRENO
112                                         GALLIUM_DRIVERS+=VC4
113
114 [X86_DRIVERS].DESCRIPTION=              Build drivers for i386 and x86_64 architectures
115 [X86_DRIVERS].MAKEFILE_ON=              DRI_DRIVERS+=R100
116                                         DRI_DRIVERS+=R200
117                                         DRI_DRIVERS+=I915
118                                         DRI_DRIVERS+=I965
119                                         GALLIUM_DRIVERS+=R300
120                                         GALLIUM_DRIVERS+=SVGA
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=,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                                         ocl-icd:primary:standard
134 [LLVMPIPE].BUILD_DEPENDS_ON=            libclc:single:standard
135                                         opencl-headers:single:standard
136 [LLVMPIPE].MAKEFILE_OFF=                MESON_ARGS+=-Dgallium-opencl=disabled
137 [LLVMPIPE].MAKEFILE_ON=                 GALLIUM_LLVM_DRIVERS+=R600
138                                         GALLIUM_LLVM_DRIVERS+=RADEONSI
139                                         GALLIUM_DRIVERS+={{GALLIUM_LLVM_DRIVERS}}
140                                         MESON_ARGS+=-Dllvm=true
141                                         MESON_ARGS+=-Dgallium-xvmc=enabled
142                                         MESON_ARGS+=-Dgallium-va=enabled
143                                         MESON_ARGS+=-Dgallium-opencl=icd
144 [LLVMPIPE].RUN_DEPENDS_ON=              clang:dynlibs:standard
145 [LLVMPIPE].USES_ON=                     clang:keepcc
146 [LLVMPIPE].XORG_COMPONENTS_ON=          xvmc
147
148 post-patch:
149         ${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' \
150                 ${WRKSRC}/src/util/xmlconfig.c
151
152 post-extract:
153         ${AWK} '/Copyright/,/DEALINGS/' ${WRKSRC}/include/GL/glext.h \
154                 > ${WRKDIR}/LICENSE_KHRONOS
155
156 [FILE:1198:descriptions/desc.libs]
157 The Mesa project began as an open-source implementation of the OpenGL
158 specification - a system for rendering interactive 3D graphics.
159
160 Over the years the project has grown to implement more graphics APIs,
161 including OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API,
162 XvMC and Vulkan.
163
164 A variety of device drivers allows the Mesa libraries to be used in many
165 different environments ranging from software emulation to complete
166 hardware acceleration for modern GPUs.
167
168 Mesa ties into several other open-source projects: the Direct Rendering
169 Infrastructure and X.org to provide OpenGL support on Linux, FreeBSD
170 and other operating systems.
171
172 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
173 These include libOSMesa, libEGL, libGL, and libglesv2 as well as utility
174 libraries libglapi and gbm.  The OSMesa library is an Off-Screen version
175 of Mesa in order to do off-screen rendering in other packages like VTK.
176 Offscreen rendering is useful for a number of things, such as batch
177 processing, parallel processing, and remote processing.
178
179 This package also contains Mesa's libOpenCL implementation "Clover".  It is
180 built upon GALLIUM and currently only supports Radeon GPUs.
181
182
183 [FILE:162:descriptions/desc.drivers]
184 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
185 These include libEGL, libGL, and libglesv2 as well as utlity libraries
186 libglapi and gbm.
187
188
189 [FILE:97:distinfo]
190 77104fd4a93bce69da3b0982f8ee88ba7c4fb98cfc491a669894339cdcd4a67d     16497248 mesa-21.3.4.tar.xz
191
192
193 [FILE:981:manifests/plist.libs]
194 %%LLVMPIPE-ON%%etc/OpenCL/vendors/mesa.icd
195 %%LLVMPIPE-ON%%lib/
196  libMesaOpenCL.so
197  libMesaOpenCL.so.1
198  libMesaOpenCL.so.1.0.0
199 %%LLVMPIPE-ON%%lib/gallium-pipe/
200  pipe_r300.so
201  pipe_r600.so
202  pipe_radeonsi.so
203  pipe_swrast.so
204  pipe_vmwgfx.so
205 include/
206  gbm.h
207  xa_composite.h
208  xa_context.h
209  xa_tracker.h
210 include/EGL/
211  egl.h
212  eglext.h
213  eglextchromium.h
214  eglmesaext.h
215  eglplatform.h
216 include/GL/
217  gl.h
218  glcorearb.h
219  glext.h
220  glx.h
221  glxext.h
222  osmesa.h
223 include/GLES2/
224  gl2.h
225  gl2ext.h
226  gl2platform.h
227 include/GLES3/
228  gl3.h
229  gl31.h
230  gl32.h
231  gl3ext.h
232  gl3platform.h
233 include/KHR/khrplatform.h
234 lib/
235  libEGL.so
236  libEGL.so.1
237  libEGL.so.1.0.0
238  libGL.so
239  libGL.so.1
240  libGL.so.1.2.0
241  libGLESv2.so
242  libGLESv2.so.2
243  libGLESv2.so.2.0.0
244  libOSMesa.so
245  libOSMesa.so.8
246  libOSMesa.so.8.0.0
247  libgbm.so
248  libgbm.so.1
249  libgbm.so.1.0.0
250  libglapi.so
251  libglapi.so.0
252  libglapi.so.0.0.0
253  libxatracker.so
254  libxatracker.so.2
255  libxatracker.so.2.5.0
256 lib/pkgconfig/
257  egl.pc
258  gbm.pc
259  gl.pc
260  glesv2.pc
261  osmesa.pc
262  xatracker.pc
263
264
265 [FILE:837:manifests/plist.drivers]
266 %%ARM_DRIVERS-ON%%lib/dri/
267  kgsl_dri.so
268  msm_dri.so
269  vc4_dri.so
270 %%LLVMPIPE-ON%%lib/
271  libXvMCr600.so
272  libXvMCr600.so.1
273  libXvMCr600.so.1.0
274  libXvMCr600.so.1.0.0
275 %%LLVMPIPE-ON%%lib/dri/
276  r600_dri.so
277  r600_drv_video.so
278  radeonsi_dri.so
279  radeonsi_drv_video.so
280 %%LLVMPIPE-ON%%lib/vdpau/
281  libvdpau_r600.so
282  libvdpau_r600.so.1
283  libvdpau_r600.so.1.0
284  libvdpau_r600.so.1.0.0
285  libvdpau_radeonsi.so
286  libvdpau_radeonsi.so.1
287  libvdpau_radeonsi.so.1.0
288  libvdpau_radeonsi.so.1.0.0
289 %%X86_DRIVERS-ON%%lib/dri/
290  i830_dri.so
291  i915_dri.so
292  i965_dri.so
293  r200_dri.so
294  r300_dri.so
295  radeon_dri.so
296  vmwgfx_dri.so
297 %%X86_DRIVERS-ON%%lib/vdpau/
298  libvdpau_r300.so
299  libvdpau_r300.so.1
300  libvdpau_r300.so.1.0
301  libvdpau_r300.so.1.0.0
302 include/GL/internal/dri_interface.h
303 lib/dri/
304  kms_swrast_dri.so
305  swrast_dri.so
306 lib/pkgconfig/dri.pc
307 share/drirc.d/00-mesa-defaults.conf
308
309
310 [FILE:512:patches/patch-include_GL_internal_dri__interface.h]
311 GCC on 9.x doesn't allow types to be overwritten, these types are defined
312 in drm.h also, which causes build issues in xorg-server.
313
314 --- include/GL/internal/dri_interface.h.orig    2022-01-12 21:32:28 UTC
315 +++ include/GL/internal/dri_interface.h
316 @@ -40,13 +40,7 @@
317  #ifndef DRI_INTERFACE_H
318  #define DRI_INTERFACE_H
319  
320 -#ifdef HAVE_LIBDRM
321  #include <drm.h>
322 -#else
323 -typedef unsigned int drm_context_t;
324 -typedef unsigned int drm_drawable_t;
325 -typedef struct drm_clip_rect drm_clip_rect_t;
326 -#endif
327  
328  #include <stdint.h>
329  
330
331
332 [FILE:227:patches/patch-src_amd_llvm_ac__llvm__build.h]
333 --- src/amd/llvm/ac_llvm_build.h.orig   2022-01-12 21:32:28 UTC
334 +++ src/amd/llvm/ac_llvm_build.h
335 @@ -35,6 +35,10 @@
336  
337  #include <stdbool.h>
338  
339 +#ifdef __sun
340 +#include <alloca.h>
341 +#endif
342 +
343  #ifdef __cplusplus
344  extern "C" {
345  #endif
346
347
348 [FILE:476:patches/patch-src_amd_vulkan_radv__device.c]
349 - Define CLOCK_MONOTONIC_RAW if missing
350
351 --- src/amd/vulkan/radv_device.c.orig   2022-01-12 21:32:28 UTC
352 +++ src/amd/vulkan/radv_device.c
353 @@ -113,6 +113,14 @@ radv_get_absolute_timeout(uint64_t timeo
354     }
355  }
356  
357 +#ifndef CLOCK_MONOTONIC_RAW
358 +# ifdef CLOCK_MONOTONIC_FAST
359 +#  define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST
360 +# else
361 +#  define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
362 +# endif
363 +#endif
364 +
365  static int
366  radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
367  {
368
369
370 [FILE:354:patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c]
371 - Define ETIME if missing
372
373 --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c.orig  2022-01-12 21:32:28 UTC
374 +++ src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
375 @@ -41,6 +41,10 @@
376  
377  enum { VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024 };
378  
379 +#ifndef ETIME
380 +#define ETIME ETIMEDOUT
381 +#endif
382 +
383  struct radv_amdgpu_ib {
384     struct radeon_winsys_bo *bo;
385     unsigned cdw;
386
387
388 [FILE:557:patches/patch-src_egl_drivers_dri2_egl__dri2.c]
389 --- src/egl/drivers/dri2/egl_dri2.c.orig        2022-01-12 21:32:28 UTC
390 +++ src/egl/drivers/dri2/egl_dri2.c
391 @@ -1000,11 +1000,13 @@ dri2_setup_screen(_EGLDisplay *disp)
392               disp->Extensions.KHR_gl_texture_3D_image = EGL_TRUE;
393        }
394  #ifdef HAVE_LIBDRM
395 +# ifndef __DragonFly__
396        if (dri2_dpy->image->base.version >= 8 &&
397            dri2_dpy->image->createImageFromDmaBufs) {
398           disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE;
399           disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_TRUE;
400        }
401 +# endif
402  #endif
403     }
404  
405
406
407 [FILE:790:patches/patch-src_egl_drivers_dri2_platform__wayland.c]
408 --- src/egl/drivers/dri2/platform_wayland.c.orig        2022-01-12 21:32:28 UTC
409 +++ src/egl/drivers/dri2/platform_wayland.c
410 @@ -1384,6 +1384,7 @@ registry_handle_global_drm(void *data, s
411        dri2_dpy->wl_drm =
412           wl_registry_bind(registry, name, &wl_drm_interface, MIN2(version, 2));
413        wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
414 +#ifndef __DragonFly__
415     } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version >= 3) {
416        dri2_dpy->wl_dmabuf =
417           wl_registry_bind(registry, name, &zwp_linux_dmabuf_v1_interface,
418 @@ -1391,6 +1392,7 @@ registry_handle_global_drm(void *data, s
419        zwp_linux_dmabuf_v1_add_listener(dri2_dpy->wl_dmabuf, &dmabuf_listener,
420                                         dri2_dpy);
421     }
422 +#endif
423  }
424  
425  static void
426
427
428 [FILE:281:patches/patch-src_egl_main_eglglobals.c]
429 --- src/egl/main/eglglobals.c.orig      2022-01-12 21:32:28 UTC
430 +++ src/egl/main/eglglobals.c
431 @@ -41,6 +41,10 @@
432  #include "util/macros.h"
433  #include "util/os_misc.h"
434  
435 +#ifdef __DragonFly__
436 +#undef HAVE_MINCORE
437 +#endif
438 +
439  #ifdef HAVE_MINCORE
440  #include <unistd.h>
441  #include <sys/mman.h>
442
443
444 [FILE:3256:patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c]
445 Revert the following commit.
446
447 FreeBSD and DragonFly don't have the required render nodes.
448
449 -------
450
451 From 69a1b9959e59653da262185c4e2cf57d24939b19 Mon Sep 17 00:00:00 2001
452 From: Emil Velikov <emil.l.velikov@gmail.com>
453 Date: Mon, 29 Jun 2015 12:36:45 +0100
454 Subject: pipe-loader: drop support for non-render node devices
455
456 Render nodes have been around for quite some time. Removing support via
457 the master/primary node allows us to clean up the conditional
458 compilation and simplify the build greatly.
459
460 For example currently we the pipe-loader, which explicitly links against
461 xcb and friends (for X auth) if found at compile-time. That
462 would cause problems as one will be forced to use X/xcb, even if it's a
463 headless system that is used for opencl.
464
465 v2: Clarify the linking topic in the commit message.
466
467 Cc: Tom Stellard <thomas.stellard@amd.com>
468 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
469 Reviewed-by: Francisco Jerez <currojerez@riseup.net>
470
471
472 --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig    2022-01-12 21:32:28 UTC
473 +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
474 @@ -198,6 +198,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa
475  }
476  
477  static int
478 +open_drm_minor(int minor)
479 +{
480 +   char path[PATH_MAX];
481 +   snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor);
482 +   return open(path, O_RDWR, 0);
483 +}
484 +
485 +static int
486  open_drm_render_node_minor(int minor)
487  {
488     char path[PATH_MAX];
489 @@ -209,8 +217,15 @@ open_drm_render_node_minor(int minor)
490  int
491  pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
492  {
493 -   int i, j, fd;
494 +   int i, k, fd, num_render_node_devs;
495 +   int j = 0;
496 +
497 +   struct {
498 +      unsigned vendor_id;
499 +      unsigned chip_id;
500 +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
501  
502 +   /* Look for render nodes first */
503     for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
504          i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
505        struct pipe_loader_device *dev;
506 @@ -224,6 +239,9 @@ pipe_loader_drm_probe(struct pipe_loader
507           continue;
508        }
509  
510 +      render_node_devs[j].vendor_id = dev->u.pci.vendor_id;
511 +      render_node_devs[j].chip_id = dev->u.pci.chip_id;
512 +
513        if (j < ndev) {
514           devs[j] = dev;
515        } else {
516 @@ -233,6 +251,46 @@ pipe_loader_drm_probe(struct pipe_loader
517        j++;
518     }
519  
520 +   num_render_node_devs = j;
521 +
522 +   /* Next look for drm devices. */
523 +   for (i = 0; i < DRM_MAX_MINOR; i++) {
524 +      struct pipe_loader_device *dev;
525 +      boolean duplicate = FALSE;
526 +      fd = open_drm_minor(i);
527 +      if (fd < 0)
528 +         continue;
529 +
530 +      if (!pipe_loader_drm_probe_fd(&dev, fd)) {
531 +         close(fd);
532 +         continue;
533 +      }
534 +
535 +      /* Check to make sure we aren't already accessing this device via
536 +       * render nodes.
537 +       */
538 +      for (k = 0; k < num_render_node_devs; k++) {
539 +         if (dev->u.pci.vendor_id == render_node_devs[k].vendor_id &&
540 +             dev->u.pci.chip_id == render_node_devs[k].chip_id) {
541 +            close(fd);
542 +            dev->ops->release(&dev);
543 +            duplicate = TRUE;
544 +            break;
545 +         }
546 +      }
547 +
548 +      if (duplicate)
549 +         continue;
550 +
551 +      if (j < ndev) {
552 +         devs[j] = dev;
553 +      } else {
554 +         dev->ops->release(&dev);
555 +      }
556 +
557 +      j++;
558 +   }
559 +
560     return j;
561  }
562  
563
564
565 [FILE:271:patches/patch-src_gallium_auxiliary_rbug_rbug__texture.c]
566 --- src/gallium/auxiliary/rbug/rbug_texture.c.orig      2022-01-12 21:32:28 UTC
567 +++ src/gallium/auxiliary/rbug/rbug_texture.c
568 @@ -36,6 +36,10 @@
569  
570  #include "c99_alloca.h"
571  
572 +#ifdef __sun
573 +#include <alloca.h>
574 +#endif
575 +
576  #include "rbug_internal.h"
577  #include "rbug_texture.h"
578  
579
580
581 [FILE:357:patches/patch-src_gallium_auxiliary_renderonly_renderonly.c]
582 --- src/gallium/auxiliary/renderonly/renderonly.c.orig  2022-01-12 21:32:28 UTC
583 +++ src/gallium/auxiliary/renderonly/renderonly.c
584 @@ -37,6 +37,10 @@
585  #include "util/u_inlines.h"
586  #include "util/u_memory.h"
587  
588 +#ifndef O_CLOEXEC
589 +#define O_CLOEXEC 0
590 +#endif
591 +
592  void
593  renderonly_scanout_destroy(struct renderonly_scanout *scanout,
594                            struct renderonly *ro)
595
596
597 [FILE:544:patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c]
598 --- src/gallium/drivers/radeonsi/si_state_shaders.c.orig        2022-01-12 21:32:28 UTC
599 +++ src/gallium/drivers/radeonsi/si_state_shaders.c
600 @@ -2228,6 +2228,7 @@ static void si_build_shader_variant(stru
601        return;
602     }
603  
604 +#ifndef __sun
605     if (shader->compiler_ctx_state.is_debug_context) {
606        FILE *f = open_memstream(&shader->shader_log, &shader->shader_log_size);
607        if (f) {
608 @@ -2235,6 +2236,7 @@ static void si_build_shader_variant(stru
609           fclose(f);
610        }
611     }
612 +#endif
613  
614     si_shader_init_pm4_state(sscreen, shader);
615  }
616
617
618 [FILE:360:patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c]
619 # define ETIME as ETIMEOUT same as in intel driver
620 #
621 --- src/gallium/drivers/vc4/vc4_bufmgr.c.orig   2022-01-12 21:32:28 UTC
622 +++ src/gallium/drivers/vc4/vc4_bufmgr.c
623 @@ -27,6 +27,9 @@
624  #include <fcntl.h>
625  #include <xf86drm.h>
626  #include <xf86drmMode.h>
627 +#ifndef ETIME
628 +#define ETIME ETIMEDOUT
629 +#endif
630  
631  #include "util/u_hash_table.h"
632  #include "util/u_memory.h"
633
634
635 [FILE:271:patches/patch-src_gallium_winsys_amdgpu_drm_amdgpu__cs.c]
636 --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c.orig      2022-01-12 21:32:28 UTC
637 +++ src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
638 @@ -33,6 +33,10 @@
639  
640  #include "amd/common/sid.h"
641  
642 +#ifdef __sun__
643 +#include <alloca.h>
644 +#endif
645 +
646  /* FENCES */
647  
648  static struct pipe_fence_handle *
649
650
651 [FILE:575:patches/patch-src_glx_glxext.c]
652 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
653 #
654 --- src/glx/glxext.c.orig       2022-01-12 21:32:28 UTC
655 +++ src/glx/glxext.c
656 @@ -924,6 +924,9 @@ __glXInitialize(Display * dpy)
657  #if defined(GLX_USE_DRM)
658     if (glx_direct && glx_accel) {
659  #if defined(HAVE_DRI3)
660 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
661 +      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
662 +#endif
663        if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
664           dpyPriv->dri3Display = dri3_create_display(dpy);
665  #endif /* HAVE_DRI3 */
666
667
668 [FILE:318:patches/patch-src_glx_meson.build]
669 --- src/glx/meson.build.orig    2022-01-12 21:32:28 UTC
670 +++ src/glx/meson.build
671 @@ -135,7 +135,7 @@ libglx = static_library(
672      extra_libs_libglx,
673    ],
674    dependencies : [
675 -    idep_mesautil, idep_xmlconfig,
676 +    idep_xmlconfig, idep_mesautil,
677      dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd,
678    ],
679  )
680
681
682 [FILE:1012:patches/patch-src_intel_common_intel__measure.c]
683 --- src/intel/common/intel_measure.c.orig       2022-01-12 21:32:28 UTC
684 +++ src/intel/common/intel_measure.c
685 @@ -42,6 +42,46 @@
686  #include "util/macros.h"
687  #include "util/u_debug.h"
688  
689 +#ifdef __sun
690 +static int
691 +mkfifoat(int fd, const char *path, mode_t mode)
692 +{
693 +       int     er, curfd = -1, newfd = -1;
694 +
695 +       /* Get our current directory then switch to the given one. */
696 +
697 +       if (fd != AT_FDCWD) {
698 +               if ((curfd = open(".", O_RDONLY, 0)) == -1)
699 +                       return -1;
700 +               if (fchdir(fd) == -1)
701 +                       goto out;
702 +       }
703 +
704 +       if ((newfd = mkfifo(path, mode)) == -1)
705 +               goto out;
706 +
707 +       /* This leaves the fifo if it fails. */
708 +
709 +       if (curfd != -1 && fchdir(curfd) == -1)
710 +               goto out;
711 +       if (curfd != -1)
712 +               close(curfd);
713 +
714 +       return newfd;
715 +out:
716 +       /* Ignore errors in close(2). */
717 +
718 +       er = errno;
719 +       if (curfd != -1)
720 +               fchdir(curfd);
721 +       if (curfd != -1)
722 +               close(curfd);
723 +       if (newfd != -1)
724 +               close(newfd);
725 +       errno = er;
726 +       return -1;
727 +}
728 +#endif
729  
730  static const struct debug_control debug_control[] = {
731     { "draw",            INTEL_MEASURE_DRAW       },
732
733
734 [FILE:1014:patches/patch-src_intel_compiler_brw__eu__validate.c]
735 --- src/intel/compiler/brw_eu_validate.c.orig   2022-01-12 21:32:28 UTC
736 +++ src/intel/compiler/brw_eu_validate.c
737 @@ -41,6 +41,39 @@
738  #include <stdlib.h>
739  #include "brw_eu.h"
740  
741 +#ifdef __sun__
742 +#include <string.h>
743 +
744 +static void *
745 +memmem(const void *l, size_t l_len, const void *s, size_t s_len)
746 +{
747 +       char *cur, *last;
748 +       const char *cl = (const char *)l;
749 +       const char *cs = (const char *)s;
750 +
751 +       /* we need something to compare */
752 +       if (l_len == 0 || s_len == 0)
753 +               return NULL;
754 +
755 +       /* "s" must be smaller or equal to "l" */
756 +       if (l_len < s_len)
757 +               return NULL;
758 +
759 +       /* special case where s_len == 1 */
760 +       if (s_len == 1)
761 +               return memchr(l, (int)*cs, l_len);
762 +
763 +       /* the last position where its possible to find "s" in "l" */
764 +       last = (char *)cl + l_len - s_len;
765 +
766 +       for (cur = (char *)cl; cur <= last; cur++)
767 +               if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
768 +                       return cur;
769 +
770 +       return NULL;
771 +}
772 +#endif
773 +
774  /* We're going to do lots of string concatenation, so this should help. */
775  struct string {
776     char *str;
777
778
779 [FILE:954:patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp]
780 --- src/intel/compiler/brw_fs_bank_conflicts.cpp.orig   2022-01-12 21:32:28 UTC
781 +++ src/intel/compiler/brw_fs_bank_conflicts.cpp
782 @@ -309,8 +309,13 @@ namespace {
783           const unsigned align = MAX2(sizeof(void *), __alignof__(vector_type));
784           const unsigned size = DIV_ROUND_UP(n, vector_width) * sizeof(vector_type);
785           void *p;
786 +#ifdef __sun
787 +       p = memalign(align, size);
788 +       if (p == NULL) return NULL;
789 +#else
790           if (posix_memalign(&p, align, size))
791              return NULL;
792 +#endif
793           memset(p, 0, size);
794           return reinterpret_cast<vector_type *>(p);
795        }
796 @@ -737,7 +742,7 @@ namespace {
797                     const weight_vector_type &conflicts)
798     {
799        const unsigned m = DIV_ROUND_UP(conflicts.size, vector_width);
800 -      vector_type s_p = {}, s_n = {};
801 +      vector_type s_p = {0}, s_n = {0};
802  
803        for (unsigned r = 0; r < m; r++) {
804           s_p = adds(s_p, mask(bank_mask_p.v[r], conflicts.v[r]));
805
806
807 [FILE:234:patches/patch-src_intel_isl_isl.h]
808 --- src/intel/isl/isl.h.orig    2022-01-12 21:32:28 UTC
809 +++ src/intel/isl/isl.h
810 @@ -48,6 +48,9 @@
811  #include "util/format/u_format.h"
812  
813  #ifdef __cplusplus
814 +# ifdef __sun__
815 +# define restrict      __restrict__
816 +# endif
817  extern "C" {
818  #endif
819  
820
821
822 [FILE:302:patches/patch-src_intel_tools_aubinator__error__decode.c]
823 # expose getline in FreeBSD's stdio.h
824 #
825 --- src/intel/tools/aubinator_error_decode.c.orig       2022-01-12 21:32:28 UTC
826 +++ src/intel/tools/aubinator_error_decode.c
827 @@ -22,6 +22,9 @@
828   *
829   */
830  
831 +#ifdef __FreeBSD__
832 +#define _WITH_GETLINE
833 +#endif
834  #include <stdbool.h>
835  #include <stdio.h>
836  #include <stdlib.h>
837
838
839 [FILE:238:patches/patch-src_intel_tools_error2aub.c]
840 --- src/intel/tools/error2aub.c.orig    2022-01-12 21:32:28 UTC
841 +++ src/intel/tools/error2aub.c
842 @@ -22,6 +22,9 @@
843   *
844   */
845  
846 +#ifdef __FreeBSD__
847 +#define _WITH_GETLINE
848 +#endif
849  #include <assert.h>
850  #include <getopt.h>
851  #include <inttypes.h>
852
853
854 [FILE:936:patches/patch-src_mesa_drivers_dri_i965_brw__bufmgr.c]
855 --- src/mesa/drivers/dri/i965/brw_bufmgr.c.orig 2022-01-12 21:32:28 UTC
856 +++ src/mesa/drivers/dri/i965/brw_bufmgr.c
857 @@ -85,6 +85,10 @@
858  } while (0)
859  
860  
861 +#ifndef O_CLOEXEC
862 +#define O_CLOEXEC      0
863 +#endif
864 +
865  /* VALGRIND_FREELIKE_BLOCK unfortunately does not actually undo the earlier
866   * VALGRIND_MALLOCLIKE_BLOCK but instead leaves vg convinced the memory is
867   * leaked. All because it does not call VG(cli_free) from its
868 @@ -1891,8 +1895,12 @@ brw_bufmgr_create(struct intel_device_in
869        bufmgr->initial_kflags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
870  
871        /* Allocate VMA in userspace if we have softpin and full PPGTT. */
872 +#ifdef __DragonFly__
873 +      if (false) {
874 +#else
875        if (gem_param(fd, I915_PARAM_HAS_EXEC_SOFTPIN) > 0 &&
876            gem_param(fd, I915_PARAM_HAS_ALIASING_PPGTT) > 1) {
877 +#endif
878           bufmgr->initial_kflags |= EXEC_OBJECT_PINNED;
879  
880           util_vma_heap_init(&bufmgr->vma_allocator[BRW_MEMZONE_LOW_4G],
881
882
883 [FILE:711:patches/patch-src_mesa_drivers_dri_i965_brw__disk__cache.c]
884 --- src/mesa/drivers/dri/i965/brw_disk_cache.c.orig     2022-01-12 21:32:28 UTC
885 +++ src/mesa/drivers/dri/i965/brw_disk_cache.c
886 @@ -394,6 +394,7 @@ brw_disk_cache_init(struct brw_screen *s
887     if (INTEL_DEBUG(DEBUG_DISK_CACHE_DISABLE_MASK))
888        return;
889  
890 +# ifdef HAVE_DL_ITERATE_PHDR
891     /* array length: print length + null char + 1 extra to verify it is unused */
892     char renderer[11];
893     ASSERTED int len = snprintf(renderer, sizeof(renderer), "i965_%04x",
894 @@ -413,5 +414,6 @@ brw_disk_cache_init(struct brw_screen *s
895     const uint64_t driver_flags =
896        brw_get_compiler_config_value(screen->compiler);
897     screen->disk_cache = disk_cache_create(renderer, timestamp, driver_flags);
898 +# endif
899  #endif
900  }
901
902
903 [FILE:851:patches/patch-src_mesa_drivers_dri_i965_brw__program__binary.c]
904 --- src/mesa/drivers/dri/i965/brw_program_binary.c.orig 2022-01-12 21:32:28 UTC
905 +++ src/mesa/drivers/dri/i965/brw_program_binary.c
906 @@ -36,9 +36,11 @@ static uint8_t driver_sha1[20];
907  void
908  brw_program_binary_init(unsigned device_id)
909  {
910 +#ifdef HAVE_DL_ITERATE_PHDR
911     const struct build_id_note *note =
912        build_id_find_nhdr_for_addr(brw_program_binary_init);
913     assert(note);
914 +#endif
915  
916     /**
917      * With Mesa's megadrivers, taking the sha1 of i965_dri.so may not be
918 @@ -52,7 +54,9 @@ brw_program_binary_init(unsigned device_
919     int len = snprintf(renderer, sizeof(renderer), "i965_%04x", device_id);
920     assert(len == sizeof(renderer) - 1);
921     _mesa_sha1_update(&ctx, renderer, len);
922 +#ifdef HAVE_DL_ITERATE_PHDR
923     _mesa_sha1_update(&ctx, build_id_data(note), build_id_length(note));
924 +#endif
925     _mesa_sha1_final(&ctx, driver_sha1);
926  }
927  
928
929
930 [FILE:328:patches/patch-src_util_build__id.c]
931 # Elf_ doesn't exist, use Elf32_ or Elf64_
932 #
933 --- src/util/build_id.c.orig    2022-01-12 21:32:28 UTC
934 +++ src/util/build_id.c
935 @@ -35,7 +35,11 @@
936  #endif
937  
938  #ifndef ElfW
939 -#define ElfW(type) Elf_##type
940 +#ifdef __LP64__
941 +#define ElfW(type) Elf64_##type
942 +#else
943 +#define ElfW(type) Elf32_##type
944 +#endif
945  #endif
946  
947  struct build_id_note {
948
949
950 [FILE:422:patches/patch-src_util_compiler.h]
951 --- src/util/compiler.h.orig    2022-01-12 21:32:28 UTC
952 +++ src/util/compiler.h
953 @@ -51,6 +51,9 @@
954  #if defined(__linux__)
955  #include <byteswap.h>
956  #define CPU_TO_LE32( x )       bswap_32( x )
957 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
958 +#include <sys/endian.h>
959 +#define CPU_TO_LE32( x )       bswap32( x )
960  #elif defined(__APPLE__)
961  #include <CoreFoundation/CFByteOrder.h>
962  #define CPU_TO_LE32( x )       CFSwapInt32HostToLittle( x )
963
964
965 [FILE:1512:patches/patch-src_util_futex.h]
966 - Implement futex_wake() and futex_wait() via _umtx_op()
967
968 --- src/util/futex.h.orig       2022-01-12 21:32:28 UTC
969 +++ src/util/futex.h
970 @@ -30,10 +30,35 @@
971  #include <limits.h>
972  #include <stdint.h>
973  #include <unistd.h>
974 +#if defined(__FreeBSD__)
975 +#include <errno.h>
976 +# if __FreeBSD__ < 11
977 +#  include <machine/atomic.h>
978 +# endif
979 +#include <sys/umtx.h>
980 +#else
981  #include <linux/futex.h>
982  #include <sys/syscall.h>
983 +#endif
984  #include <sys/time.h>
985  
986 +#if defined(__FreeBSD__)
987 +static inline int futex_wake(uint32_t *addr, int count)
988 +{
989 +   return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
990 +}
991 +
992 +static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
993 +{
994 +   void *uaddr = NULL, *uaddr2 = NULL;
995 +   if (timeout != NULL) {
996 +      const struct _umtx_time tmo = { ._timeout = *timeout, ._flags = UMTX_ABSTIME, ._clockid = CLOCK_MONOTONIC };
997 +      uaddr = (void *)(uintptr_t)sizeof(tmo);
998 +      uaddr2 = (void *)&tmo;
999 +   }
1000 +   return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == -1 ? errno : 0;
1001 +}
1002 +#else
1003  static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
1004  {
1005     return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
1006 @@ -51,6 +76,7 @@ static inline int futex_wait(uint32_t *a
1007     return sys_futex(addr, FUTEX_WAIT_BITSET, value, timeout, NULL,
1008                      FUTEX_BITSET_MATCH_ANY);
1009  }
1010 +#endif
1011  
1012  #elif defined(__FreeBSD__)
1013  #define UTIL_FUTEX_SUPPORTED 1
1014
1015
1016 [FILE:239:patches/patch-src_util_libsync.h]
1017 --- src/util/libsync.h.orig     2022-01-12 21:32:28 UTC
1018 +++ src/util/libsync.h
1019 @@ -37,6 +37,10 @@
1020  #include <sys/poll.h>
1021  #include <unistd.h>
1022  
1023 +#ifdef __sun__
1024 +#include <sys/ioccom.h>
1025 +#endif
1026 +
1027  #if defined(__cplusplus)
1028  extern "C" {
1029  #endif
1030
1031
1032 [FILE:310:patches/patch-src_util_memstream.c]
1033 --- src/util/memstream.c.orig   2022-01-12 21:32:28 UTC
1034 +++ src/util/memstream.c
1035 @@ -51,7 +51,7 @@ u_memstream_open(struct u_memstream *mem
1036     }
1037  
1038     return success;
1039 -#elif defined(__APPLE__)
1040 +#elif defined(__APPLE__) || defined(__sun)
1041     return false;
1042  #else
1043     FILE *const f = open_memstream(bufp, sizep);
1044
1045
1046 [FILE:230:patches/patch-src_util_os__file.c]
1047 --- src/util/os_file.c.orig     2022-01-12 21:32:28 UTC
1048 +++ src/util/os_file.c
1049 @@ -25,6 +25,9 @@
1050  #endif
1051  #endif
1052  
1053 +#ifndef ENODATA
1054 +#define ENODATA ENOATTR
1055 +#endif
1056  
1057  FILE *
1058  os_file_create_unique(const char *filename, int filemode)
1059
1060
1061 [FILE:592:patches/patch-src_util_os__memory__aligned.h]
1062 --- src/util/os_memory_aligned.h.orig   2022-01-12 21:32:28 UTC
1063 +++ src/util/os_memory_aligned.h
1064 @@ -53,11 +53,16 @@ add_overflow_size_t(size_t a, size_t b,
1065  static inline void *
1066  os_malloc_aligned(size_t size, size_t alignment)
1067  {
1068 +#ifdef __sun__
1069 +   alignment = (alignment + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
1070 +   return memalign(alignment, size);
1071 +#else
1072     void *ptr;
1073     alignment = (alignment + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
1074     if(posix_memalign(&ptr, alignment, size) != 0)
1075        return NULL;
1076     return ptr;
1077 +#endif
1078  }
1079  
1080  #define os_free_aligned(_ptr) free(_ptr)
1081
1082
1083 [FILE:853:patches/patch-src_util_strndup.h]
1084 --- src/util/strndup.h.orig     2022-01-12 21:32:28 UTC
1085 +++ src/util/strndup.h
1086 @@ -24,7 +24,7 @@
1087  #ifndef STRNDUP_H
1088  #define STRNDUP_H
1089  
1090 -#if defined(_WIN32)
1091 +#if defined(_WIN32) || defined(__sun)
1092  
1093  #include <stdlib.h> // size_t
1094  #include <string.h>
1095 @@ -34,6 +34,7 @@ extern "C" {
1096  #endif
1097  
1098  static inline char *
1099 +#if defined(_WIN32)
1100  strndup(const char *str, size_t max)
1101  {
1102     size_t n;
1103 @@ -50,6 +51,22 @@ strndup(const char *str, size_t max)
1104     memcpy(ptr, str, n);
1105     return ptr;
1106  }
1107 +#else  // version without strnlen
1108 +strndup(const char *str, size_t n)
1109 +{
1110 +    size_t len;
1111 +    char *copy;
1112 +
1113 +    len = strlen(str);
1114 +    if (len <= n)
1115 +        return (strdup(str));
1116 +    if ((copy = (char *)malloc(len + 1)) == NULL)
1117 +        return (NULL);
1118 +    memcpy(copy, str, len);
1119 +    copy[len] = '\0';
1120 +    return (copy);
1121 +}
1122 +#endif
1123  
1124  #ifdef __cplusplus
1125  }
1126
1127
1128 [FILE:430:patches/patch-src_util_u__atomic.h]
1129 --- src/util/u_atomic.h.orig    2022-01-12 21:32:28 UTC
1130 +++ src/util/u_atomic.h
1131 @@ -20,11 +20,7 @@
1132   * locally coded assembly, compiler intrinsic or ultimately a
1133   * mutex-based implementation.
1134   */
1135 -#if defined(__sun)
1136 -#define PIPE_ATOMIC_OS_SOLARIS
1137 -#elif defined(_MSC_VER)
1138 -#define PIPE_ATOMIC_MSVC_INTRINSIC
1139 -#elif defined(__GNUC__)
1140 +#if defined(__GNUC__)
1141  #define PIPE_ATOMIC_GCC_INTRINSIC
1142  #else
1143  #error "Unsupported platform"
1144
1145
1146 [FILE:415:patches/patch-src_util_u__cpu__detect.c]
1147 Segment runs on NetBSD and OpenBSD only
1148
1149 --- src/util/u_cpu_detect.c.orig        2022-01-12 21:32:28 UTC
1150 +++ src/util/u_cpu_detect.c
1151 @@ -623,7 +623,7 @@ util_cpu_detect_once(void)
1152     if (available_cpus == 0) {
1153        const int mib[] = { CTL_HW, HW_NCPUONLINE };
1154        int ncpu;
1155 -      int len = sizeof(ncpu);
1156 +      size_t len = sizeof(ncpu);
1157  
1158        sysctl(mib, 2, &ncpu, &len, NULL, 0);
1159        available_cpus = ncpu;
1160
1161
1162 [FILE:188:patches/patch-src_util_u__math.h]
1163 --- src/util/u_math.h.orig      2022-01-12 21:32:28 UTC
1164 +++ src/util/u_math.h
1165 @@ -51,6 +51,7 @@
1166  extern "C" {
1167  #endif
1168  
1169 +#undef ALIGN
1170  
1171  #ifndef M_SQRT2
1172  #define M_SQRT2 1.41421356237309504880
1173
1174
1175 [FILE:1523:patches/patch-src_util_u__thread.h]
1176 --- src/util/u_thread.h.orig    2022-01-12 21:32:28 UTC
1177 +++ src/util/u_thread.h
1178 @@ -40,6 +40,7 @@
1179  #include <signal.h>
1180  #ifdef HAVE_PTHREAD_NP_H
1181  #include <pthread_np.h>
1182 +#undef ALIGN
1183  #endif
1184  #endif
1185  
1186 @@ -129,7 +130,7 @@ static inline thrd_t u_thread_create(int
1187  static inline void u_thread_setname( const char *name )
1188  {
1189  #if defined(HAVE_PTHREAD)
1190 -#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS
1191 +#if DETECT_OS_LINUX || DETECT_OS_CYGWIN
1192     int ret = pthread_setname_np(pthread_self(), name);
1193     if (ret == ERANGE) {
1194        char buf[16];
1195 @@ -138,7 +139,7 @@ static inline void u_thread_setname( con
1196        buf[len] = '\0';
1197        pthread_setname_np(pthread_self(), buf);
1198     }
1199 -#elif DETECT_OS_FREEBSD || DETECT_OS_OPENBSD
1200 +#elif DETECT_OS_FREEBSD || DETECT_OS_OPENBSD || DETECT_OS_DRAGONFLY
1201     pthread_set_name_np(pthread_self(), name);
1202  #elif DETECT_OS_NETBSD
1203     pthread_setname_np(pthread_self(), "%s", (void *)name);
1204 @@ -146,8 +147,6 @@ static inline void u_thread_setname( con
1205     pthread_setname_np(name);
1206  #elif DETECT_OS_HAIKU
1207     rename_thread(find_thread(NULL), name);
1208 -#else
1209 -#warning Not sure how to call pthread_setname_np
1210  #endif
1211  #endif
1212     (void)name;
1213 @@ -242,7 +241,7 @@ util_set_current_thread_affinity(const u
1214  static inline int64_t
1215  util_thread_get_time_nano(thrd_t thread)
1216  {
1217 -#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__)
1218 +#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__sun)
1219     struct timespec ts;
1220     clockid_t cid;
1221  
1222
1223
1224 [FILE:25:files/special.mk]
1225 GALLIUM_DRIVERS+=       SWRAST
1226
1227
1228 [FILE:911:sunos/patch-src_gallium_targets_dri_meson.build]
1229 --- src/gallium/targets/dri/meson.build.orig    2020-12-31 03:59:58 UTC
1230 +++ src/gallium/targets/dri/meson.build
1231 @@ -45,11 +45,12 @@ libgallium_dri = shared_library(
1232      inc_gallium_winsys, include_directories('../../frontends/dri'),
1233    ],
1234    gnu_symbol_visibility : 'hidden',
1235 -  link_args : [ld_args_build_id, ld_args_gc_sections, gallium_dri_ld_args],
1236 +  link_args : [ld_args_gc_sections, gallium_dri_ld_args],
1237    link_depends : gallium_dri_link_depends,
1238 +  link_whole : [libdri, libdricommon, libgallium, libr300, _libnir, libglsl, libglcpp], # libr600, libamd_common
1239    link_with : [
1240 -    libdri, libmesa_gallium, libdricommon, libmegadriver_stub, libgalliumvl,
1241 -    libgallium, libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
1242 +    libmesa_gallium, libmegadriver_stub, libgalliumvl,
1243 +    libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
1244      libswkmsdri,
1245    ],
1246    dependencies : [
1247
1248
1249 [FILE:424:sunos/patch-src_gallium_targets_opencl_meson.build]
1250 --- src/gallium/targets/opencl/meson.build.orig 2021-01-29 18:33:19 UTC
1251 +++ src/gallium/targets/opencl/meson.build
1252 @@ -90,7 +90,7 @@ libopencl = shared_library(
1253    [],
1254    link_args : [ld_args_gc_sections, opencl_link_args],
1255    link_depends : opencl_link_deps,
1256 -  link_whole : libclover,
1257 +  link_whole : [libclover,libmesa_format],
1258    link_with : [libpipe_loader_dynamic, libgallium],
1259    dependencies : [
1260      idep_mesautil,
1261
1262
1263 [FILE:604:sunos/patch-src_gallium_targets_osmesa_meson.build]
1264 --- src/gallium/targets/osmesa/meson.build.orig 2020-12-31 03:59:58 UTC
1265 +++ src/gallium/targets/osmesa/meson.build
1266 @@ -49,9 +49,9 @@ libosmesa = shared_library(
1267      inc_gallium_drivers,
1268    ],
1269    link_depends : osmesa_link_deps,
1270 -  link_whole : [libosmesa_st, libglapi_static],
1271 +  link_whole : [libosmesa_st, libglapi_static, libsoftpipe, libgallium, _libnir, libglsl, libglcpp],
1272    link_with : [
1273 -    libmesa_gallium, libgallium, libws_null, osmesa_link_with,
1274 +    libmesa_gallium, libws_null, osmesa_link_with,
1275    ],
1276    dependencies : [
1277      dep_ws2_32, dep_selinux, dep_thread, dep_clock, dep_unwind,
1278
1279
1280 [FILE:2062:sunos/patch-src_gallium_targets_pipe-loader_meson.build]
1281 --- src/gallium/targets/pipe-loader/meson.build.orig    2021-01-29 18:33:19 UTC
1282 +++ src/gallium/targets/pipe-loader/meson.build
1283 @@ -57,16 +57,16 @@ if with_gallium_v3d
1284  endif
1285  
1286  pipe_loaders = [
1287 -  [with_gallium_i915, 'i915', driver_i915, []],
1288 -  [with_gallium_iris, 'iris', [driver_iris, idep_xmlconfig], []],
1289 -  [with_gallium_nouveau, 'nouveau', driver_nouveau, []],
1290 -  [with_gallium_r300, 'r300', driver_r300, []],
1291 -  [with_gallium_r600, 'r600', driver_r600, []],
1292 -  [with_gallium_radeonsi, 'radeonsi', [driver_radeonsi, idep_xmlconfig], []],
1293 -  [with_gallium_freedreno, 'msm', driver_freedreno, []],
1294 -  [with_gallium_kmsro, 'kmsro', _kmsro_targets, []],
1295 -  [with_gallium_svga, 'vmwgfx', driver_svga, []],
1296 -  [with_gallium_softpipe, 'swrast', [driver_swrast, driver_swr], [libwsw, libws_null]],
1297 +  [with_gallium_i915, 'i915', driver_i915, [], []],
1298 +  [with_gallium_iris, 'iris', [driver_iris, idep_xmlconfig], [], []],
1299 +  [with_gallium_nouveau, 'nouveau', driver_nouveau, [], []],
1300 +  [with_gallium_r300, 'r300', driver_r300, [], [libr300,libradeonwinsys,libmesa_format]],
1301 +  [with_gallium_r600, 'r600', driver_r600, [], [libr600,libradeonwinsys,libmesa_format,libgalliumvl]],
1302 +  [with_gallium_radeonsi, 'radeonsi', [driver_radeonsi], [], [libradeonsi,libradeonwinsys,libamd_common,libamd_common_llvm,libmesa_format,_libxmlconfig,libgalliumvl]],
1303 +  [with_gallium_freedreno, 'msm', driver_freedreno, [], []],
1304 +  [with_gallium_kmsro, 'kmsro', _kmsro_targets, [], []],
1305 +  [with_gallium_svga, 'vmwgfx', driver_svga, [], [libsvga,libsvgadrm,libmesa_format]],
1306 +  [with_gallium_softpipe, 'swrast', [driver_swrast, driver_swr], [libwsw, libws_null], [libllvmpipe,libmesa_format,libsoftpipe]],
1307  ]
1308  
1309  foreach x : pipe_loaders
1310 @@ -80,6 +80,7 @@ foreach x : pipe_loaders
1311        link_args : pipe_loader_link_args,
1312        link_depends : pipe_loader_link_deps,
1313        include_directories : pipe_loader_incs,
1314 +      link_whole : [x[4]],
1315        link_with : [pipe_loader_link_with, x[3]],
1316        dependencies : [idep_mesautil, idep_nir, dep_thread, x[2]],
1317        name_prefix : '',
1318
1319
1320 [FILE:838:sunos/patch-src_gallium_targets_va_meson.build]
1321 --- src/gallium/targets/va/meson.build.orig     2021-01-29 18:33:19 UTC
1322 +++ src/gallium/targets/va/meson.build
1323 @@ -39,13 +39,14 @@ libva_gallium = shared_library(
1324    include_directories : [
1325      inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_gallium_winsys, inc_gallium_drivers,
1326    ],
1327 -  link_whole : [libva_st],
1328 +  link_whole : [libva_st, _libxmlconfig, libmesa_format, libloader, libpipe_loader_static],
1329    link_with : [
1330      libgalliumvlwinsys, libgalliumvl, libgallium,
1331 -    libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri,
1332 +    libws_null, libwsw, libswdri, libswkmsdri,
1333 +    libr600, libradeonsi,
1334    ],
1335    dependencies : [
1336 -    dep_libdrm, driver_r600, driver_radeonsi, driver_nouveau,
1337 +    dep_libdrm, driver_nouveau,
1338      idep_mesautil,
1339    ],
1340    link_depends : va_link_depends,
1341
1342
1343 [FILE:784:sunos/patch-src_gallium_targets_vdpau_meson.build]
1344 --- src/gallium/targets/vdpau/meson.build.orig  2020-12-31 03:59:58 UTC
1345 +++ src/gallium/targets/vdpau/meson.build
1346 @@ -44,10 +44,10 @@ libvdpau_gallium = shared_library(
1347    include_directories : [
1348      inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_gallium_winsys, inc_gallium_drivers,
1349    ],
1350 -  link_whole : [libvdpau_st],
1351 +  link_whole : [libvdpau_st, libr300, libradeonwinsys, libmesa_format, _libxmlconfig, libpipe_loader_static, libgallium, _libnir], # libr600, libradeonsi, libamd_common, libamd_common_llvm,
1352    link_with : [
1353      libgalliumvlwinsys, libgalliumvl, libgallium,
1354 -    libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri,
1355 +    libws_null, libwsw, libswdri, libswkmsdri,
1356    ],
1357    dependencies : [
1358      idep_mesautil,
1359
1360
1361 [FILE:670:sunos/patch-src_gallium_targets_xa_meson.build]
1362 --- src/gallium/targets/xa/meson.build.orig     2020-12-31 03:59:58 UTC
1363 +++ src/gallium/targets/xa/meson.build
1364 @@ -40,9 +40,9 @@ libxatracker = shared_library(
1365    include_directories : [
1366      inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_gallium_winsys, inc_gallium_drivers,
1367    ],
1368 -  link_whole : [libxa_st],
1369 +  link_whole : [libxa_st, libsvga, libsvgadrm, libpipe_loader_static, libmesa_format, _libxmlconfig, libgallium, _libnir],
1370    link_with : [
1371 -    libgalliumvl_stub, libgallium, libpipe_loader_static,
1372 +    libgalliumvl_stub, libgallium,
1373      libws_null, libwsw, libswdri, libswkmsdri,
1374    ],
1375    link_depends : xa_link_depends,
1376
1377
1378 [FILE:846:sunos/patch-src_gallium_targets_xvmc_meson.build]
1379 --- src/gallium/targets/xvmc/meson.build.orig   2021-01-29 18:33:19 UTC
1380 +++ src/gallium/targets/xvmc/meson.build
1381 @@ -39,12 +39,12 @@ libxvmc_gallium = shared_library(
1382    include_directories : [
1383      inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_gallium_winsys, inc_gallium_drivers,
1384    ],
1385 -  link_whole : [libxvmc_st],
1386 +  link_whole : [libxvmc_st,libradeonwinsys,libr600,_libxmlconfig,libmesa_format,libpipe_loader_static],
1387    link_with : [
1388      libgalliumvlwinsys, libgalliumvl, libgallium,
1389      libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri,
1390    ],
1391 -  dependencies : [idep_mesautil, driver_r600, driver_nouveau],
1392 +  dependencies : [idep_mesautil, driver_nouveau],
1393    link_depends : xvmc_link_depends,
1394    # Will be deleted during installation, see install_megadrivers.py
1395    install : true,
1396
1397
1398 [FILE:510:sunos/patch-src_gbm_meson.build]
1399 --- src/gbm/meson.build.orig    2021-01-29 18:33:19 UTC
1400 +++ src/gbm/meson.build
1401 @@ -49,8 +49,8 @@ libgbm = shared_library(
1402    include_directories : incs_gbm,
1403    c_args : [args_gbm],
1404    link_args : [ld_args_gc_sections],
1405 -  link_with : libloader,
1406 -  dependencies : [deps_gbm, dep_dl, dep_thread, idep_mesautil, idep_xmlconfig],
1407 +  link_with : [libloader, _libxmlconfig],
1408 +  dependencies : [deps_gbm, dep_dl, dep_thread, idep_mesautil],
1409    gnu_symbol_visibility : 'hidden',
1410    version : '1.0.0',
1411    install : true,
1412
1413
1414 [FILE:997:sunos/patch-src_mesa_drivers_dri_meson.build]
1415 --- src/mesa/drivers/dri/meson.build.orig       2020-12-31 03:59:58 UTC
1416 +++ src/mesa/drivers/dri/meson.build
1417 @@ -20,7 +20,7 @@
1418  
1419  subdir('common')
1420  
1421 -_dri_drivers = []
1422 +_dri_drivers = [ _libnir, libmesa_classic, libmesa_common, libintel_compiler, libglcpp, libdricommon ]
1423  _dri_link = []
1424  if with_dri_swrast
1425    subdir('swrast')
1426 @@ -59,14 +59,13 @@ if _dri_drivers != []
1427      [],
1428      link_whole : _dri_drivers,
1429      link_with : [
1430 -      libmegadriver_stub, libdricommon, libglapi,
1431 -      libmesa_classic,
1432 +      libmegadriver_stub, libglapi, libintel_dev,
1433      ],
1434      dependencies : [
1435        dep_selinux, dep_libdrm, dep_m, dep_thread, dep_dl,
1436 -      idep_nir, idep_xmlconfig, idep_mesautil,
1437 +      idep_xmlconfig, idep_mesautil,
1438      ],
1439 -    link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
1440 +    link_args : [ld_args_build_id, ld_args_gc_sections],
1441      # Will be deleted during installation, see install_megadrivers.py
1442      install : true,
1443      install_dir : dri_drivers_path,
1444