summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2022-03-13 15:50:05 +0000
committertnn <tnn@pkgsrc.org>2022-03-13 15:50:05 +0000
commitda02083ce6ce77ed90db4be4c628118150f99df1 (patch)
tree26a51edd4d6ea1ecea2b146c2fecc918c857abaa /graphics
parent847972a2f07c296459ee3768c7773a68b498e5f9 (diff)
downloadpkgsrc-da02083ce6ce77ed90db4be4c628118150f99df1.tar.gz
MesaLib: update to 21.3.7
Of particular note is this change in Mesa 21.2: "32-bit x86 builds now default disable x87 math and use sse2." This might need to be revisited in pkgsrc. Bugfixes omitted from ChangeLog. New features in Mesa 21.3: VK_EXT_color_write_enable on lavapipe GL_ARB_texture_filter_anisotropic in llvmpipe Anisotropic texture filtering in lavapipe VK_EXT_shader_atomic_float2 on Intel and RADV. VK_EXT_vertex_input_dynamic_state on RADV. VK_KHR_timeline_semaphore on lavapipe VK_EXT_external_memory_host on lavapipe GL_AMD_pinned_memory on llvmpipe GL 4.5 compatibility on llvmpipe VK_EXT_primitive_topology_list_restart on RADV and lavapipe. ES 3.2 on zink VK_KHR_depth_stencil_resolve on lavapipe VK_KHR_shader_integer_dot_product on RADV. OpenGL FP16 support on llvmpipe VK_KHR_shader_float16_int8 on lavapipe VK_KHR_shader_subgroup_extended_types on lavapipe VK_KHR_spirv_1_4 on lavapipe Experimental raytracing support on RADV VK_KHR_synchronization2 on Intel NGG shader based culling is now enabled by default on GFX10.3 on RADV. VK_KHR_maintenance4 on RADV VK_KHR_format_feature_flags2 on RADV. EGL_EXT_present_opaque on wayland New features in Mesa 21.2: zink supports GL_ARB_texture_filter_minmax, GL_ARB_shader_clock VK_EXT_provoking_vertex on RADV. VK_EXT_extended_dynamic_state2 on RADV. VK_EXT_global_priority_query on RADV. VK_EXT_physical_device_drm on RADV. VK_KHR_shader_subgroup_uniform_control_flow on Intel and RADV. VK_EXT_color_write_enable on RADV. 32-bit x86 builds now default disable x87 math and use sse2. GL ES 3.1 on GT21x hardware. VK_EXT_acquire_drm_display on RADV and ANV. VK_EXT_vertex_input_dynamic_state on lavapipe wideLines on lavapipe VK_EXT_line_rasterization on lavapipe VK_EXT_multi_draw on ANV, lavapipe, and RADV VK_KHR_separate_depth_stencil_layouts on lavapipe VK_EXT_separate_stencil_usage on lavapipe VK_EXT_extended_dynamic_state2 on lavapipe NGG shader based primitive culling is now supported by RADV. Panfrost supports OpenGL ES 3.1 New Asahi driver for the Apple M1 GL_ARB_sample_locations on zink GL_ARB_sparse_buffer on zink GL_ARB_shader_group_vote on zink DRM format modifiers on zink freedreno+turnip: Initial support for a6xx gen4 (a660, a635) New features in Mesa 21.1: VK_KHR_workgroup_memory_explicit_layout on Intel, RADV DRM format modifiers for AMD. VK_KHR_zero_initialize_workgroup_memory on Intel, RADV Zink exposes GL 4.6 and ES 3.1 GL_EXT_depth_bounds_test on softpipe, zink GL_EXT_texture_filter_minmax on nvc0 (gm200+) GL_ARB_texture_filter_minmax on nvc0 (gm200+) GL_ARB_post_depth_coverage on zink VK_KHR_copy_commands2 on lavapipe lavapipe exposes Vulkan 1.1 VRS attachment on RADV New features in Mesa 21.0: GL_EXT_demote_to_helper_invocation on radeonsi GL_NV_compute_shader_derivatives on radeonsi EGL_MESA_platform_xcb Removed GL_NV_point_sprite for classic swrast. driconf: remove glx_disable_oml_sync_control, glx_disable_sgi_video_sync, and glx_disable_ext_buffer_age Removed support for loading DRI drivers older than Mesa 8.0, including all DRI1 support Add support for VK_VALVE_mutable_descriptor_type on RADV Removed classic OSMesa in favor of the newly improved gallium OSMesa VK_KHR_fragment_shading_rate on RADV (RDNA2 only) Freedreno a6xx exposes GL 3.3 Classic swrast dri driver removed in favor of gallium swrast (llvmpipe or softpipe) Panfrost g31/g52/g72 exposes ES 3.0 Panfrost t760+ exposes GL 3.1 (including on Bifrost) Sparse memory support on RADV Rapid packed math (16bit-vectorization) on RADV New features in Mesa 20.3: GL 4.5 on llvmpipe GL_INTEL_blackhole_render on radeonsi GL_NV_copy_depth_to_color for NIR GL_NV_half_float GL_NV_shader_atomic_int64 on radeonsi EGL_KHR_swap_buffers_with_damage on X11 (DRI3) VK_PRESENT_MODE_FIFO_RELAXED on X11 GLX_EXT_swap_control for DRI2 and DRI3 GLX_EXT_swap_control_tear for DRI3 VK_KHR_copy_commands2 on RADV VK_KHR_shader_terminate_invocation on RADV NGG GS support in ACO VK_KHR_shader_terminate_invocation on ANV driconf: add glx_extension_override driconf: add indirect_gl_extension_override VK_AMD_mixed_attachment_samples on RADV (GFX6-GFX7). GL_MESA_pack_invert on r100 and vieux GL_ANGLE_pack_reverse_row_order VK_EXT_shader_image_atomic_int64 on RADV New features in mesa 20.2: GL_ARB_compute_variable_group_size on Iris. GL_ARB_gpu_shader5 on llvmpipe GL_ARB_post_depth_coverage on llvmpipe GLES 3.2 on llvmpipe GL_EXT_shader_group_vote on GLES3. GL_EXT_texture_shadow_lod on llvmpipe VK_AMD_texture_gather_bias_lod on RADV. VK_AMD_gpu_shader_half_float on RADV/ACO. VK_AMD_gpu_shader_int16 on RADV/ACO. VK_EXT_extended_dynamic_state on ANV and RADV. VK_EXT_image_robustness on RADV. VK_EXT_private_data on ANV and RADV. VK_EXT_custom_border_color on ANV and RADV. VK_EXT_pipeline_creation_cache_control on ANV and RADV. VK_EXT_shader_demote_to_helper_invocation on RADV/LLVM. VK_EXT_subgroup_size_control on RADV/ACO. VK_GOOGLE_user_type on ANV and RADV. VK_KHR_shader_subgroup_extended_types on RADV/ACO. GL_ARB_gl_spirv on nvc0/nir. GL_ARB_spirv_extensions on nvc0/nir. RADV now uses ACO per default as backend RADV_DEBUG=llvm option to enable LLVM backend for RADV VK_EXT_image_robustness for ANV VK_EXT_shader_atomic_float on ANV VK_EXT_4444_formats on ANV and RADV. VK_KHR_memory_model on RADV. GL 4.5 on llvmpipe EGL_KHR_swap_buffers_with_damage on X11 (DRI3) New features in mesa 20.1: GL_ARB_compute_variable_group_size on i965. GL_EXT_depth_bounds_test on Iris. GL_EXT_texture_shadow_lod on radeonsi, nvc0. GL_NV_alpha_to_coverage_dither_control on radeonsi GL_NV_copy_image on all gallium drivers. GL_NV_pixel_buffer_object on all gallium drivers, i915, i965, swrast. GL_NV_viewport_array2 on nvc0 (GM200+). GL_NV_viewport_swizzle on nvc0 (GM200+). VK_AMD_memory_overallocation_behavior on RADV. VK_KHR_shader_non_semantic_info on Intel, RADV. GL_EXT_draw_instanced on gles2 VK_KHR_8bit_storage for ACO on GFX8+ VK_KHR_16bit_storage for ACO on GFX8+ (storageInputOutput16 is still unsupported) shaderInt16 for ACO on GFX9+ VK_KHR_shader_float16_int8 for ACO on GFX8+ (shaderFloat16 is still unsupported) VK_EXT_robustness2 on Intel, RADV. Add Rocket Lake (RKL) support on anvil and iris.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/MesaLib/Makefile47
-rw-r--r--graphics/MesaLib/PLIST46
-rw-r--r--graphics/MesaLib/distinfo52
-rw-r--r--graphics/MesaLib/options.mk24
-rw-r--r--graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c19
-rw-r--r--graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c29
-rw-r--r--graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c21
-rw-r--r--graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp41
-rw-r--r--graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp40
-rw-r--r--graphics/MesaLib/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c16
-rw-r--r--graphics/MesaLib/patches/patch-src_glx_dri__glx.c43
-rw-r--r--graphics/MesaLib/patches/patch-src_glx_glxclient.h10
-rw-r--r--graphics/MesaLib/patches/patch-src_glx_glxcurrent.c12
-rw-r--r--graphics/MesaLib/patches/patch-src_glx_glxext.c20
-rw-r--r--graphics/MesaLib/patches/patch-src_intel_genxml_gen__sort__tags.py57
-rw-r--r--graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h9
-rw-r--r--graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h12
-rw-r--r--graphics/MesaLib/patches/patch-src_mapi_glapi_gen_glX__XML.py25
-rw-r--r--graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__XML.py43
-rw-r--r--graphics/MesaLib/patches/patch-src_mapi_u__current.c14
-rw-r--r--graphics/MesaLib/patches/patch-src_mapi_u__current.h16
-rw-r--r--graphics/MesaLib/patches/patch-src_mesa_main_extensions.c12
-rw-r--r--graphics/MesaLib/patches/patch-src_mesa_main_macros.h18
-rw-r--r--graphics/MesaLib/patches/patch-src_mesa_main_marshal.h16
-rw-r--r--graphics/MesaLib/patches/patch-src_util_u__queue.c34
-rw-r--r--graphics/MesaLib/patches/patch-src_util_u__thread.h108
26 files changed, 205 insertions, 579 deletions
diff --git a/graphics/MesaLib/Makefile b/graphics/MesaLib/Makefile
index a59d53e676a..5b5d01ae54a 100644
--- a/graphics/MesaLib/Makefile
+++ b/graphics/MesaLib/Makefile
@@ -1,8 +1,7 @@
-# $NetBSD: Makefile,v 1.198 2021/12/08 16:04:48 adam Exp $
+# $NetBSD: Makefile,v 1.199 2022/03/13 15:50:05 tnn Exp $
-DISTNAME= mesa-20.0.6
+DISTNAME= mesa-21.3.7
PKGNAME= ${DISTNAME:S/mesa/MesaLib/}
-PKGREVISION= 2
CATEGORIES= graphics
MASTER_SITES= https://mesa.freedesktop.org/archive/
EXTRACT_SUFX= .tar.xz
@@ -35,51 +34,43 @@ MESA_PLATFORMS= #
.include "options.mk"
PLIST_SUBST+= GLVER="1.2.0"
+PLIST_SUBST+= MACHINE_ARCH=${MACHINE_ARCH}
# classic DRI drivers
-PLIST_VARS+= i915 i965 r100 r200 nouveau_dri
+PLIST_VARS+= i830 i915 i965 r100 r200 nouveau_dri
# Gallium drivers
-PLIST_VARS+= r300 svga nouveau vc4 lima panfrost
+PLIST_VARS+= r300 svga nouveau iris
# other features
-PLIST_VARS+= kms vaapi
+PLIST_VARS+= arm kms vaapi
.if ${MESALIB_SUPPORTS_DRI} == "yes"
BUILDLINK_API_DEPENDS.libdrm+= libdrm>=2.4.100
.include "../../x11/libdrm/buildlink3.mk"
-MESA_PLATFORMS+= drm surfaceless
+. if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+. include "../../sysutils/libpciaccess/buildlink3.mk"
+. endif
MESON_ARGS+= -Degl=true
MESON_ARGS+= -Dgbm=true
-MESON_ARGS+= -Dgallium-xa=true
+MESON_ARGS+= -Dgallium-xa=enabled
. if ${X11_TYPE} == "native" && !exists(${X11BASE}/include/xcb/dri3.h)
MESON_ARGS+= -Ddri3=false
. endif
PLIST.kms= yes
. if !empty(MACHINE_ARCH:M*arm*) || \
${MACHINE_CPU} == "aarch64"
-# ARM Mali Utgard
-GALLIUM_DRIVERS+= lima
-PLIST.lima= yes
-# ARM Mali Midgard, Bifrost
-GALLIUM_DRIVERS+= panfrost
-PLIST.panfrost= yes
-# Vivante GCxxx
-#GALLIUM_DRIVERS+= etnaviv
-#PLIST.etnaviv= yes
-# Qualcomm Snapdragon
-#GALLIUM_DRIVERS+= freedreno
-#PLIST.freedreno= yes
-# Broadcom VideoCore 4
-GALLIUM_DRIVERS+= vc4
-PLIST.vc4= yes
+GALLIUM_DRIVERS+= freedreno vc4 etnaviv tegra panfrost lima
+PLIST.arm= yes
. endif
. if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-GALLIUM_DRIVERS+= svga
+GALLIUM_DRIVERS+= svga iris
DRI_DRIVERS+= i915 i965
PLIST.svga= yes
+PLIST.i830= yes
PLIST.i915= yes
PLIST.i965= yes
+PLIST.iris= yes
. endif
# FreeBSD lacks nouveau support (there are official binaries from Nvidia)
. if ${OPSYS} != "FreeBSD"
@@ -107,14 +98,14 @@ PLIST.r300= yes
. if ${VAAPI_AVAILABLE} == "yes" && \
!(empty(GALLIUM_DRIVERS:Mr600) && empty(GALLIUM_DRIVERS:Mradeonsi) && \
empty(GALLIUM_DRIVERS:Mnouveau))
-MESON_ARGS+= -Dgallium-va=true
+MESON_ARGS+= -Dgallium-va=enabled
PLIST.vaapi= yes
+BUILDLINK_API_DEPENDS.libva+= libva>=2.13.0
. include "../../multimedia/libva/buildlink3.mk"
. else
-MESON_ARGS+= -Dgallium-va=false
+MESON_ARGS+= -Dgallium-va=disabled
. endif
.else
-MESA_PLATFORMS+= surfaceless
MESON_ARGS+= -Degl=false
MESON_ARGS+= -Dgbm=false
.endif # ${MESALIB_SUPPORTS_DRI} == "yes"
@@ -132,7 +123,7 @@ CXXFLAGS+= -march=i586
MESON_ARGS+= -Dgles1=true
MESON_ARGS+= -Dgles2=true
-MESON_ARGS+= -Dosmesa=gallium
+MESON_ARGS+= -Dosmesa=true
MESON_ARGS+= -Dshared-glapi=true
MESON_ARGS+= -Dgallium-xvmc=false
diff --git a/graphics/MesaLib/PLIST b/graphics/MesaLib/PLIST
index 891aa16a941..764b3bd74ea 100644
--- a/graphics/MesaLib/PLIST
+++ b/graphics/MesaLib/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.46 2019/11/30 11:02:39 nia Exp $
+@comment $NetBSD: PLIST,v 1.47 2022/03/13 15:50:05 tnn Exp $
${PLIST.kms}include/EGL/egl.h
${PLIST.kms}include/EGL/eglext.h
${PLIST.kms}include/EGL/eglextchromium.h
@@ -28,14 +28,35 @@ ${PLIST.kms}include/gbm.h
${PLIST.kms}include/xa_composite.h
${PLIST.kms}include/xa_context.h
${PLIST.kms}include/xa_tracker.h
+${PLIST.arm}lib/dri/armada-drm_dri.so
+${PLIST.arm}lib/dri/etnaviv_dri.so
+${PLIST.arm}lib/dri/exynos_dri.so
+${PLIST.arm}lib/dri/hx8357d_dri.so
+${PLIST.i830}lib/dri/i830_dri.so
${PLIST.i915}lib/dri/i915_dri.so
${PLIST.i965}lib/dri/i965_dri.so
+${PLIST.arm}lib/dri/ili9225_dri.so
+${PLIST.arm}lib/dri/ili9341_dri.so
+${PLIST.arm}lib/dri/imx-dcss_dri.so
+${PLIST.arm}lib/dri/imx-drm_dri.so
+${PLIST.arm}lib/dri/ingenic-drm_dri.so
+${PLIST.iris}lib/dri/iris_dri.so
+${PLIST.arm}lib/dri/kgsl_dri.so
+${PLIST.arm}lib/dri/kirin_dri.so
${PLIST.kms}lib/dri/kms_swrast_dri.so
-${PLIST.lima}lib/dri/lima_dri.so
+${PLIST.arm}lib/dri/lima_dri.so
+${PLIST.arm}lib/dri/mali-dp_dri.so
+${PLIST.arm}lib/dri/mcde_dri.so
+${PLIST.arm}lib/dri/mediatek_dri.so
+${PLIST.arm}lib/dri/meson_dri.so
+${PLIST.arm}lib/dri/mi0283qt_dri.so
+${PLIST.arm}lib/dri/msm_dri.so
+${PLIST.arm}lib/dri/mxsfb-drm_dri.so
${PLIST.nouveau}lib/dri/nouveau_dri.so
${PLIST.nouveau}${PLIST.vaapi}lib/dri/nouveau_drv_video.so
${PLIST.nouveau_dri}lib/dri/nouveau_vieux_dri.so
-${PLIST.panfrost}lib/dri/panfrost_dri.so
+${PLIST.arm}lib/dri/panfrost_dri.so
+${PLIST.arm}lib/dri/pl111_dri.so
${PLIST.r200}lib/dri/r200_dri.so
${PLIST.r300}lib/dri/r300_dri.so
${PLIST.r600}lib/dri/r600_dri.so
@@ -43,8 +64,15 @@ ${PLIST.r600}${PLIST.vaapi}lib/dri/r600_drv_video.so
${PLIST.r100}lib/dri/radeon_dri.so
${PLIST.radeonsi}lib/dri/radeonsi_dri.so
${PLIST.r600}${PLIST.vaapi}lib/dri/radeonsi_drv_video.so
+${PLIST.arm}lib/dri/repaper_dri.so
+${PLIST.arm}lib/dri/rockchip_dri.so
+${PLIST.arm}lib/dri/st7586_dri.so
+${PLIST.arm}lib/dri/st7735r_dri.so
+${PLIST.arm}lib/dri/stm_dri.so
+${PLIST.arm}lib/dri/sun4i-drm_dri.so
lib/dri/swrast_dri.so
-${PLIST.vc4}lib/dri/vc4_dri.so
+${PLIST.arm}lib/dri/tegra_dri.so
+${PLIST.arm}lib/dri/vc4_dri.so
${PLIST.svga}lib/dri/vmwgfx_dri.so
${PLIST.kms}lib/libEGL.so
${PLIST.kms}lib/libEGL.so.1
@@ -67,6 +95,11 @@ ${PLIST.kms}lib/libgbm.so.1.0.0
lib/libglapi.so
lib/libglapi.so.0
lib/libglapi.so.0.0.0
+${PLIST.vulkan}${PLIST.arm}lib/libvulkan_broadcom.so
+${PLIST.vulkan}${PLIST.arm}lib/libvulkan_freedreno.so
+${PLIST.vulkan_intel}lib/libvulkan_intel.so
+${PLIST.vulkan}lib/libvulkan_lvp.so
+${PLIST.vulkan}lib/libvulkan_radeon.so
${PLIST.kms}lib/libxatracker.so
${PLIST.kms}lib/libxatracker.so.2
${PLIST.kms}lib/libxatracker.so.2.5.0
@@ -95,3 +128,8 @@ ${PLIST.radeonsi}${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1
${PLIST.radeonsi}${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0
${PLIST.radeonsi}${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0.0
share/examples/mesa/00-mesa-defaults.conf
+${PLIST.vulkan}${PLIST.arm}share/vulkan/icd.d/broadcom_icd.${MACHINE_ARCH}.json
+${PLIST.vulkan}${PLIST.arm}share/vulkan/icd.d/freedreno_icd.${MACHINE_ARCH}.json
+${PLIST.vulkan_intel}share/vulkan/icd.d/intel_icd.${MACHINE_ARCH}.json
+${PLIST.vulkan}share/vulkan/icd.d/lvp_icd.${MACHINE_ARCH}.json
+${PLIST.vulkan}share/vulkan/icd.d/radeon_icd.${MACHINE_ARCH}.json
diff --git a/graphics/MesaLib/distinfo b/graphics/MesaLib/distinfo
index 5e6293f6c47..1bb18c9b5a3 100644
--- a/graphics/MesaLib/distinfo
+++ b/graphics/MesaLib/distinfo
@@ -1,44 +1,44 @@
-$NetBSD: distinfo,v 1.162 2021/12/23 20:29:09 nia Exp $
+$NetBSD: distinfo,v 1.163 2022/03/13 15:50:05 tnn Exp $
-BLAKE2s (mesa-20.0.6.tar.xz) = 84bdac00a14b37b598d9077448f0013439ee76db1a2f9cbc60b1b8b12838c61c
-SHA512 (mesa-20.0.6.tar.xz) = a93dc3ed57ed7469b7c60cdbdcf4f29c5da4ec3986171c7b534e009e136ca21fec16207ffab38a6747437a9b1060e2e6c4b74c4e5cdc168b9aba0fc1940b5e90
-Size (mesa-20.0.6.tar.xz) = 12275708 bytes
-SHA1 (patch-src_amd_common_ac__debug.c) = 8233367c3b5bc344442ea8d19488fdd1e3791ae9
+BLAKE2s (mesa-21.3.7.tar.xz) = 5f14af06f483f145dcf442b66e408fc02980a7f69df343ac96686a6f01228719
+SHA512 (mesa-21.3.7.tar.xz) = 0991543e9435457fa4d077517408b3f197be32ed61a6c7ca34ddb3906eed208791f1a57227f74115f99df18e612efab1d2c6809b7cf426d273633b53d4aefc88
+Size (mesa-21.3.7.tar.xz) = 16569592 bytes
SHA1 (patch-src_compiler_builtin__type__macros.h) = e4868011711fb89a293580a12eb603b8e7162336
+SHA1 (patch-src_drm-shim_drm__shim.c) = 6884d31dc3e9d47aac1785589ab289a601e64545
SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = 9230fbae2c04246ebca8437ecad694bbae857fbe
-SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 49e48c31eacb79d1da357fe70eaffd2926b5280e
+SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = ccf7c3ba7bdac39f9924102868f30afd7f4f05a2
SHA1 (patch-src_egl_main_eglglobals.c) = 0d52014f52e62fc5fa6650336ddb0011ecf331e6
SHA1 (patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c) = f913b779404e6bd8ae707a4fd66eb7c1dca9b311
SHA1 (patch-src_gallium_auxiliary_rbug_rbug__texture.c) = 57d831b1001419191a27c05d9cb7734481372d27
+SHA1 (patch-src_gallium_drivers_freedreno_freedreno__screen.c) = 2d31c6d5b5271ad108f73234de34618f583e3e43
+SHA1 (patch-src_gallium_drivers_freedreno_freedreno__util.h) = 51f082b91b3015b99ed28a016eda2f0f1eaef675
SHA1 (patch-src_gallium_drivers_llvmpipe_lp__memory.c) = ca3c1b317c41f6ae56a08272ffabdecb38fea2ec
SHA1 (patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c) = 04f95784c3270c9bb7e95377982e217962481525
SHA1 (patch-src_gallium_drivers_nouveau_nv50_nv84__video.c) = 1b4239fe053523835ecac006894bdb0cde0ee626
-SHA1 (patch-src_gallium_drivers_radeonsi_si__state__shaders.c) = 2a6fb80e2dd8c19a73c1ae9c037e7b1769ca100f
SHA1 (patch-src_gallium_drivers_vc4_vc4__bufmgr.c) = 1d591d346486fdf58893f69ab92a272e6a31a987
-SHA1 (patch-src_gallium_state__trackers_clover_llvm_invocation.cpp) = 8c90a8aab876b262967776940774770d802fc2bc
-SHA1 (patch-src_gallium_state__trackers_clover_util_range.hpp) = cdc78067986c1b92818472c4201c58ef1b42c4f4
-SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c) = 825e6201b1efaff658297abd2f0d9a27d557703c
+SHA1 (patch-src_gallium_frontends_clover_util_range.hpp) = c1bd73721482642e62378c70cbe245c304c36d4f
+SHA1 (patch-src_gallium_frontends_osmesa_osmesa.c) = 36631301b02cf89f152925b62f538a3c0b6ab601
+SHA1 (patch-src_glx_dri__common.c) = 7fa80f8da89ba90649db170e45c8e842cf69c1eb
SHA1 (patch-src_glx_dri__common.h) = 0274877f8c65a4bb729536a897df4704897a4c6e
-SHA1 (patch-src_glx_dri__glx.c) = 8fd48776e9953b18bd17ba130d90ae2935e67242
-SHA1 (patch-src_glx_glxclient.h) = f0358179ae397bc8677597b0ccb9a471f40f15de
-SHA1 (patch-src_glx_glxcurrent.c) = a872950c2cb08f60c1d018d0490c610a764ab468
-SHA1 (patch-src_glx_glxext.c) = 15c2c5e0c6b5095ce849fb86ad148aa05d7d907a
+SHA1 (patch-src_glx_glxclient.h) = 7b59d5632e35aa945ad77cd5d1d2fc2e7711e82b
+SHA1 (patch-src_glx_glxcurrent.c) = bc844ab6bfe32c0a322ff0fc2c1405b67b90b64a
+SHA1 (patch-src_glx_glxext.c) = 1eacf9062b5926ea6c756e769bf6eebc7671ccba
SHA1 (patch-src_intel_compiler_brw__fs__bank__conflicts.cpp) = 6276d2c6846bb4dd08699921bec4e20202a17478
-SHA1 (patch-src_intel_genxml_gen__sort__tags.py) = e50d30fe74b09b100049e61660aa3606469a4047
SHA1 (patch-src_intel_tools_aubinator__error__decode.c) = d8f636e3c3e76763a505a1dce23de0b198ad62fa
-SHA1 (patch-src_mapi_entry__x86-64__tls.h) = cbbb95b96414609a9cd05af75c9544f8e6938280
-SHA1 (patch-src_mapi_entry__x86__tls.h) = d85680aa658d159017e8bad1589f95f3830ac577
-SHA1 (patch-src_mapi_glapi_gen_glX__XML.py) = 5b71960652c8bd1038695a51366635d00761aeeb
-SHA1 (patch-src_mapi_glapi_gen_gl__XML.py) = 505ba3d98f8b0b05d652c05dd52997bf5323d0fb
-SHA1 (patch-src_mapi_u__current.c) = 4e3ec6e253af3737f77ecd43e56044ba2b81e699
-SHA1 (patch-src_mapi_u__current.h) = 9f4744681381a0959fda2926a436f296c89577f3
-SHA1 (patch-src_mesa_main_extensions.c) = 2f48bdb1176c2878bb33bcfab7556172b50a987e
-SHA1 (patch-src_mesa_main_macros.h) = c5dceaa8dc02a58e5b2273d82e3fe1cc12e327d3
-SHA1 (patch-src_mesa_main_marshal.h) = 4e4c08796a61aaa9f2463a9797e382e2e29860e9
+SHA1 (patch-src_mapi_entry__x86-64__tls.h) = f3e93565a2247b47495489f2dbecdc354d4a21a0
+SHA1 (patch-src_mapi_entry__x86__tls.h) = 1ca12843b7214831c25c5cdd7860dad94312c118
+SHA1 (patch-src_mapi_u__current.c) = f10d7d56d773a30ec4f24ffc41ae68104e173a47
+SHA1 (patch-src_mesa_main_context.c) = ae26f984b30369554a0e24d03006533c75e56a9b
+SHA1 (patch-src_mesa_main_extensions.c) = 8a6094690864289393315bd0ccc4ebd1e0c59ca5
+SHA1 (patch-src_mesa_main_formats.c) = b0c31116767422efe732bc77136b03b2fddfba31
SHA1 (patch-src_mesa_main_shader__query.cpp) = 3f9c31645d87855759def11344dee16af23c7be3
SHA1 (patch-src_mesa_x86_common__x86.c) = f8c4b93443ef66d017f6aa114b877565b30f2598
SHA1 (patch-src_util_build__id.c) = 7a9547bbda9d2fb9f0018ccf27b70b59e497aa2c
+SHA1 (patch-src_util_disk__cache__os.c) = 2b87c69d99e0ecf1991a6e7f3b96605887e0b2f2
+SHA1 (patch-src_util_libsync.h) = 6711d79d9011c3ba6a592ed1639c7be811aee8b4
SHA1 (patch-src_util_strndup.h) = 73f49694ca48ad6b9a9d8346c5b84fddec2463bd
SHA1 (patch-src_util_u__atomic.h) = 31d4514538ef5ee53012695eb5c66134aaec981e
-SHA1 (patch-src_util_u__queue.c) = fe9515e8fca597962b25a60ae8f2c4cd0c61c251
-SHA1 (patch-src_util_u__thread.h) = be9107c879e7f8506aeafd3bb7e6165b74f78c46
+SHA1 (patch-src_util_u__printf.h) = 3b19d079d3857612be3cb1b5c1edb5384cd4d6fd
+SHA1 (patch-src_util_u__process.c) = 9b785d660f3d55803315598a66370139fcd9168f
+SHA1 (patch-src_util_u__queue.c) = e8d6b00473a16b6a32dcacd5ae092326fb2adb84
+SHA1 (patch-src_util_u__thread.h) = 996a51b8570cb019b9ed5ce9f3653488ce26b2df
diff --git a/graphics/MesaLib/options.mk b/graphics/MesaLib/options.mk
index 2c7d0066ca3..3b3f48d0f57 100644
--- a/graphics/MesaLib/options.mk
+++ b/graphics/MesaLib/options.mk
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.82 2021/07/22 10:34:01 tnn Exp $
+# $NetBSD: options.mk,v 1.83 2022/03/13 15:50:05 tnn Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib
@@ -63,14 +63,13 @@ BUILDLINK_TRANSFORM+= rm:-DUSE_ELF_TLS
# LLVM support
#
.if !empty(PKG_OPTIONS:Mllvm)
-MESON_ARGS+= -Dllvm=true
-BUILDLINK_API_DEPENDS.libLLVM+= libLLVM>=7.0.1nb2
+MESON_ARGS+= -Dllvm=enabled
. include "../../devel/libelf/buildlink3.mk"
. include "../../lang/libLLVM/buildlink3.mk"
. if ${OPSYS} != "Darwin" && ${OPSYS} != "Cygwin"
# This is the latest libdrm requirement for amdgpu.
-BUILDLINK_API_DEPENDS.libdrm+= libdrm>=2.4.99
+BUILDLINK_API_DEPENDS.libdrm+= libdrm>=2.4.107
PLIST.r600= yes
GALLIUM_DRIVERS+= r600
@@ -78,16 +77,25 @@ PLIST.radeonsi= yes
GALLIUM_DRIVERS+= radeonsi
. endif
.else
-MESON_ARGS+= -Dllvm=false
+MESON_ARGS+= -Dllvm=disabled
.endif
#
# Vulkan support - experimental
#
+PLIST_VARS+= vulkan vulkan_intel
.if !empty(PKG_OPTIONS:Mvulkan)
-MESON_ARGS+= -Dvulkan-drivers="auto"
-.else
-MESON_ARGS+= -Dvulkan-drivers=""
+VULKAN_DRIVERS+= amd
+VULKAN_DRIVERS+= swrast
+PLIST.vulkan= yes
+. if ${MACHINE_ARCH} == "x86_64"
+VULKAN_DRIVERS+= intel
+PLIST.vulkan_intel= yes
+. endif
+. if ${MACHINE_ARCH} == "aarch64"
+VULKAN_DRIVERS+= broadcom
+VULKAN_DRIVERS+= freedreno
+. endif
.endif
#
diff --git a/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c b/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c
deleted file mode 100644
index d74b5eeb3bb..00000000000
--- a/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD: patch-src_amd_common_ac__debug.c,v 1.1 2019/08/21 13:35:28 nia Exp $
-
-#if'out some debug code on SunOS. There is no open_memstream(3)
-
---- src/amd/common/ac_debug.c.orig 2019-01-17 11:26:22.000000000 +0000
-+++ src/amd/common/ac_debug.c
-@@ -571,10 +571,12 @@ void ac_parse_ib_chunk(FILE *f, uint32_t
-
- char *out;
- size_t outsize;
-+#if defined(HAVE_OPEN_MEMSTREAM)
- FILE *memf = open_memstream(&out, &outsize);
- ib.f = memf;
- ac_do_parse_ib(memf, &ib);
- fclose(memf);
-+#endif
-
- if (out) {
- format_ib_output(f, out);
diff --git a/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c b/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c
index 89028fbb193..b4f32c0fa3d 100644
--- a/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c
+++ b/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_egl_drivers_dri2_platform__x11.c,v 1.3 2019/08/21 13:35:28 nia Exp $
+$NetBSD: patch-src_egl_drivers_dri2_platform__x11.c,v 1.4 2022/03/13 15:50:05 tnn Exp $
Provide compat strndup for older Darwin.
@@ -15,9 +15,9 @@ without DRI3 support.
* Added logging statement to note dri3 initialization being invoked.
---- src/egl/drivers/dri2/platform_x11.c.orig 2018-02-09 02:17:57.000000000 +0000
+--- src/egl/drivers/dri2/platform_x11.c.orig 2021-07-14 20:04:46.732922600 +0000
+++ src/egl/drivers/dri2/platform_x11.c
-@@ -608,6 +608,23 @@ dri2_x11_local_authenticate(struct dri2_
+@@ -628,6 +628,23 @@ dri2_x11_local_authenticate(struct dri2_
return EGL_TRUE;
}
@@ -41,20 +41,23 @@ without DRI3 support.
static EGLBoolean
dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
{
-@@ -1466,8 +1483,15 @@ dri2_initialize_x11(_EGLDriver *drv, _EG
+@@ -1539,9 +1556,17 @@ dri2_initialize_x11(_EGLDisplay *disp)
+ return dri2_initialize_x11_swrast(disp);
- if (!disp->Options.ForceSoftware) {
#ifdef HAVE_DRI3
-- if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
+- if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
+- if (dri2_initialize_x11_dri3(disp))
++
+#if ((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)) || defined(__DragonFly__) || defined(__NetBSD__)
-+ if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
++ if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
+#endif
-+ if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) {
-+ _eglLog(_EGL_INFO, "platform_x11.c: calling dri2_initialize_x11_dri3\n");
- initialized = dri2_initialize_x11_dri3(drv, disp);
-+ if (initialized)
-+ _eglLog(_EGL_INFO, "platform_x11.c: initialized by dri2_initialize_x11_dri3\n");
++ if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) {
++ _eglLog(_EGL_INFO, "platform_x11.c: calling dri2_initialize_x11_dri3\n");
++ if (dri2_initialize_x11_dri3(disp)) {
++ _eglLog(_EGL_INFO, "platform_x11.c: initialized by dri2_initialize_x11_dri3\n");
+ return EGL_TRUE;
+ }
++ }
#endif
- if (!initialized)
+ if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false))
diff --git a/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c b/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c
deleted file mode 100644
index 6a3db29c2d2..00000000000
--- a/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD: patch-src_gallium_drivers_radeonsi_si__state__shaders.c,v 1.2 2019/10/18 09:57:07 nia Exp $
-
-#if'out some debug code on SunOS. There is no open_memstream(3)
-
---- src/gallium/drivers/radeonsi/si_state_shaders.c.orig 2019-10-09 16:52:00.000000000 +0000
-+++ src/gallium/drivers/radeonsi/si_state_shaders.c
-@@ -2113,12 +2113,14 @@ static void si_build_shader_variant(stru
- }
-
- if (shader->compiler_ctx_state.is_debug_context) {
-+#if defined(HAVE_OPEN_MEMSTREAM)
- FILE *f = open_memstream(&shader->shader_log,
- &shader->shader_log_size);
- if (f) {
- si_shader_dump(sscreen, shader, NULL, f, false);
- fclose(f);
- }
-+#endif
- }
-
- si_shader_init_pm4_state(sscreen, shader);
diff --git a/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp b/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
deleted file mode 100644
index ef48dd6c96d..00000000000
--- a/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-$NetBSD: patch-src_gallium_state__trackers_clover_llvm_invocation.cpp,v 1.2 2020/03/08 10:35:03 tnn Exp $
-
-Patch from FreeBSD ports graphics/mesa-dri 17.1.0
-
-# fix errors like the following
-#
-# llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str()
- const'
-# /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas
-ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC
-# /usr/bin/ld: final link failed: Bad value
-#
-
---- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2020-03-05 21:34:31.000000000 +0000
-+++ src/gallium/state_trackers/clover/llvm/invocation.cpp
-@@ -188,6 +188,10 @@ namespace {
- return get_lang_standard_from_version_str(device_version);
- }
-
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-+ const char* cstr(const std::string& str) { return str.c_str(); }
-+#endif
-+
- std::unique_ptr<clang::CompilerInstance>
- create_compiler_instance(const device &dev, const std::string& ir_target,
- const std::vector<std::string> &opts,
-@@ -200,9 +204,13 @@ namespace {
- // Parse the compiler options. A file name should be present at the end
- // and must have the .cl extension in order for the CompilerInvocation
- // class to recognize it as an OpenCL source file.
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-+ std::vector<const char *> copts(opts.size());
-+ std::transform(opts.begin(), opts.end(), copts.begin(), cstr);
-+#else
- const std::vector<const char *> copts =
- map(std::mem_fn(&std::string::c_str), opts);
--
-+#endif
- const target &target = ir_target;
- const std::string &device_clc_version = dev.device_clc_version();
-
diff --git a/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp b/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp
deleted file mode 100644
index ab7f36bc667..00000000000
--- a/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-$NetBSD: patch-src_gallium_state__trackers_clover_util_range.hpp,v 1.1 2019/08/21 13:35:28 nia Exp $
-
-From FreeBSD ports for mesa 17.1.10:
-
-From b95533b981af9a6687b41418e7cc2a5652fc2bdb Mon Sep 17 00:00:00 2001
-Date: Fri, 7 Mar 2014 15:16:08 +0100
-Subject: [PATCH 3/3] Work around for clang 3.4 which fails to build Clover
-
-See:
- https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3
-
---- src/gallium/state_trackers/clover/util/range.hpp.orig 2017-09-25 16:56:19.000000000 +0000
-+++ src/gallium/state_trackers/clover/util/range.hpp
-@@ -362,6 +362,14 @@ namespace clover {
- return { i, i + n };
- }
-
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-+ namespace detail {
-+ template<typename T>
-+ using fixup_function_type =
-+ typename std::conditional<std::is_function<T>::value, T &, T>::type;
-+ }
-+#endif
-+
- ///
- /// Create a range by transforming the contents of a number of
- /// source ranges \a rs element-wise using a provided functor \a f.
-@@ -369,7 +377,11 @@ namespace clover {
- /// \sa adaptor_range.
- ///
- template<typename F, typename... Rs>
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-+ adaptor_range<detail::fixup_function_type<F>, Rs...>
-+#else
- adaptor_range<F, Rs...>
-+#endif
- map(F &&f, Rs &&... rs) {
- return { std::forward<F>(f), std::forward<Rs>(rs)... };
- }
diff --git a/graphics/MesaLib/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c b/graphics/MesaLib/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
deleted file mode 100644
index 81f9751a9c2..00000000000
--- a/graphics/MesaLib/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c,v 1.5 2020/03/08 10:35:03 tnn Exp $
-
-conditionalise Linuxism
-
---- src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig 2020-03-05 21:34:31.000000000 +0000
-+++ src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
-@@ -694,7 +694,9 @@ vmw_ioctl_region_map(struct vmw_region *
- return NULL;
- }
-
-+#ifdef MADV_HUGEPAGE
- (void) madvise(map, region->size, MADV_HUGEPAGE);
-+#endif
- region->data = map;
- }
-
diff --git a/graphics/MesaLib/patches/patch-src_glx_dri__glx.c b/graphics/MesaLib/patches/patch-src_glx_dri__glx.c
deleted file mode 100644
index 64c785ec281..00000000000
--- a/graphics/MesaLib/patches/patch-src_glx_dri__glx.c
+++ /dev/null
@@ -1,43 +0,0 @@
-$NetBSD: patch-src_glx_dri__glx.c,v 1.1 2019/08/21 13:35:28 nia Exp $
-
-atexit() is not a good idea in shared libraries.
-
-FreeBSD reported atexit bug for 10.6:
-https://bugs.freedesktop.org/show_bug.cgi?id=91869
-
---- src/glx/dri_glx.c.orig 2018-01-18 21:30:28.000000000 +0000
-+++ src/glx/dri_glx.c
-@@ -183,9 +183,21 @@ static struct driver_config_entry *drive
- /* Called as an atexit function. Otherwise, this would have to be called with
- * driver_config_mutex locked.
- */
-+#if defined(HAVE_NOATEXIT)
-+static Bool e_next_ever_null = False;
-+
-+static void __attribute__((__destructor__))
-+#else
- static void
-+#endif
- clear_driver_config_cache()
- {
-+
-+#if defined(HAVE_NOATEXIT)
-+ if (!e_next_ever_null)
-+ return;
-+#endif
-+
- while (driver_config_cache) {
- struct driver_config_entry *e = driver_config_cache;
- driver_config_cache = e->next;
-@@ -276,7 +288,11 @@ glXGetDriverConfig(const char *driverNam
- driver_config_cache = e;
-
- if (!e->next)
-+#if defined(HAVE_NOATEXIT)
-+ e_next_ever_null = True;
-+#else
- atexit(clear_driver_config_cache);
-+#endif
-
- out:
- pthread_mutex_unlock(&driver_config_mutex);
diff --git a/graphics/MesaLib/patches/patch-src_glx_glxclient.h b/graphics/MesaLib/patches/patch-src_glx_glxclient.h
index a7b3b908041..9906e60fb17 100644
--- a/graphics/MesaLib/patches/patch-src_glx_glxclient.h
+++ b/graphics/MesaLib/patches/patch-src_glx_glxclient.h
@@ -1,13 +1,13 @@
-$NetBSD: patch-src_glx_glxclient.h,v 1.2 2019/08/21 13:35:28 nia Exp $
+$NetBSD: patch-src_glx_glxclient.h,v 1.3 2022/03/13 15:50:05 tnn Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
---- src/glx/glxclient.h.orig 2017-02-13 11:55:49.000000000 +0000
+--- src/glx/glxclient.h.orig 2021-08-04 18:49:29.150474000 +0000
+++ src/glx/glxclient.h
-@@ -661,7 +661,11 @@ extern void __glXSetCurrentContext(struc
- extern __thread void *__glX_tls_Context
- __attribute__ ((tls_model("initial-exec")));
+@@ -648,7 +648,11 @@ extern void __glXSetCurrentContext(struc
+
+ extern __THREAD_INITIAL_EXEC void *__glX_tls_Context;
+#if defined(__NetBSD__)
+# define __glXGetCurrentContext() (likely(__glX_tls_Context) ? __glX_tls_Context : (void*)&dummyContext)
diff --git a/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c b/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c
index 294b35ae2bf..5756875e9b6 100644
--- a/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c
+++ b/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c
@@ -1,11 +1,11 @@
-$NetBSD: patch-src_glx_glxcurrent.c,v 1.4 2020/02/19 21:03:41 tnn Exp $
+$NetBSD: patch-src_glx_glxcurrent.c,v 1.5 2022/03/13 15:50:05 tnn Exp $
Interim fix for toolchain/50277.
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
---- src/glx/glxcurrent.c.orig 2019-12-04 22:10:12.000000000 +0000
+--- src/glx/glxcurrent.c.orig 2021-08-04 18:49:29.150474000 +0000
+++ src/glx/glxcurrent.c
@@ -40,6 +40,20 @@
#include "glx_error.h"
@@ -28,14 +28,14 @@ with dlopen(3) at the moment.
** We setup some dummy structures here so that the API can be used
** even if no context is current.
*/
-@@ -77,7 +91,11 @@ _X_HIDDEN pthread_mutex_t __glXmutex = P
+@@ -76,7 +90,11 @@ _X_HIDDEN pthread_mutex_t __glXmutex = P
+ * \b never be \c NULL. This is important! Because of this
* \c __glXGetCurrentContext can be implemented as trivial macro.
*/
- __thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
+#if defined(__NetBSD__)
-+ = NULL; /* non-zero initializers not supported with dlopen */
++__THREAD_INITIAL_EXEC void *__glX_tls_Context = NULL; /* non-zero initializers not supported with dlopen */
+#else
- = &dummyContext;
+ __THREAD_INITIAL_EXEC void *__glX_tls_Context = &dummyContext;
+#endif
_X_HIDDEN void
diff --git a/graphics/MesaLib/patches/patch-src_glx_glxext.c b/graphics/MesaLib/patches/patch-src_glx_glxext.c
index de73a6d69f7..49be4b3a6d9 100644
--- a/graphics/MesaLib/patches/patch-src_glx_glxext.c
+++ b/graphics/MesaLib/patches/patch-src_glx_glxext.c
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_glx_glxext.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+$NetBSD: patch-src_glx_glxext.c,v 1.2 2022/03/13 15:50:05 tnn Exp $
* Patch from FreeBSD ports graphics/mesa-dri 18.0.0
@@ -8,17 +8,9 @@ $NetBSD: patch-src_glx_glxext.c,v 1.1 2019/08/21 13:35:28 nia Exp $
* Added logging statements to note dri3 initialization being invoked.
---- src/glx/glxext.c.orig 2017-12-08 13:49:11.000000000 +0000
+--- src/glx/glxext.c.orig 2021-07-14 20:04:55.750010300 +0000
+++ src/glx/glxext.c
-@@ -55,6 +55,7 @@
- #include <xcb/xcb.h>
- #include <xcb/glx.h>
-
-+#include "dri_common.h"
-
- #ifdef DEBUG
- void __glXDumpDrawBuffer(struct glx_context * ctx);
-@@ -817,7 +818,11 @@ AllocAndFetchScreenConfigs(Display * dpy
+@@ -819,7 +819,11 @@ AllocAndFetchScreenConfigs(Display * dpy
#if defined(GLX_USE_DRM)
#if defined(HAVE_DRI3)
if (priv->dri3Display)
@@ -30,7 +22,7 @@ $NetBSD: patch-src_glx_glxext.c,v 1.1 2019/08/21 13:35:28 nia Exp $
#endif /* HAVE_DRI3 */
if (psc == NULL && priv->dri2Display)
psc = (*priv->dri2Display->createScreen) (i, priv);
-@@ -920,8 +925,13 @@ __glXInitialize(Display * dpy)
+@@ -925,8 +929,13 @@ __glXInitialize(Display * dpy)
#if defined(GLX_USE_DRM)
if (glx_direct && glx_accel) {
#if defined(HAVE_DRI3)
@@ -43,5 +35,5 @@ $NetBSD: patch-src_glx_glxext.c,v 1.1 2019/08/21 13:35:28 nia Exp $
dpyPriv->dri3Display = dri3_create_display(dpy);
+ }
#endif /* HAVE_DRI3 */
- dpyPriv->dri2Display = dri2CreateDisplay(dpy);
- dpyPriv->driDisplay = driCreateDisplay(dpy);
+ if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false))
+ dpyPriv->dri2Display = dri2CreateDisplay(dpy);
diff --git a/graphics/MesaLib/patches/patch-src_intel_genxml_gen__sort__tags.py b/graphics/MesaLib/patches/patch-src_intel_genxml_gen__sort__tags.py
deleted file mode 100644
index 6a11453144b..00000000000
--- a/graphics/MesaLib/patches/patch-src_intel_genxml_gen__sort__tags.py
+++ /dev/null
@@ -1,57 +0,0 @@
-$NetBSD: patch-src_intel_genxml_gen__sort__tags.py,v 1.1 2021/01/06 15:50:02 triaxx Exp $
-
-Remove deprecated .getchildren() that are no longer supported in Python 3.9.
-https://cgit.freedesktop.org/mesa/mesa/commit/src/intel/genxml/gen_sort_tags.py?id=6a841
-
---- src/intel/genxml/gen_sort_tags.py.orig 2021-01-06 15:09:48.383488000 +0100
-+++ src/intel/genxml/gen_sort_tags.py
-@@ -65,7 +65,7 @@
- return
- if node.tag != 'struct' and node.tag != 'group':
- return
-- for c in node.getchildren():
-+ for c in node:
- add_struct_refs(items, c)
-
-
-@@ -115,7 +115,7 @@
- for a in attribs:
- if a in node.attrib:
- f.write(' {0}="{1}"'.format(a, node.attrib[a]))
-- children = node.getchildren()
-+ children = list(node)
- if len(children) > 0:
- f.write('>\n')
- for c in children:
-@@ -138,7 +138,7 @@
- enum_dict = {}
- for e in enums:
- values = e.findall('./value')
-- e[:] = sorted(e.getchildren(), key=get_value)
-+ e[:] = sorted(e, key=get_value)
- enum_dict[e.attrib['name']] = e
-
- # Structs are a bit annoying because they can refer to each other. We sort
-@@ -147,7 +147,7 @@
- structs = sorted(xml.findall('./struct'), key=get_name)
- wrapped_struct_dict = {}
- for s in structs:
-- s[:] = sorted(s.getchildren(), key=get_start)
-+ s[:] = sorted(s, key=get_start)
- ws = Struct(s)
- wrapped_struct_dict[ws.name] = ws
-
-@@ -161,11 +161,11 @@
-
- instructions = sorted(xml.findall('./instruction'), key=get_name)
- for i in instructions:
-- i[:] = sorted(i.getchildren(), key=get_start)
-+ i[:] = sorted(i, key=get_start)
-
- registers = sorted(xml.findall('./register'), key=get_name)
- for r in registers:
-- r[:] = sorted(r.getchildren(), key=get_start)
-+ r[:] = sorted(r, key=get_start)
-
- genxml[:] = enums + sorted_structs.values() + instructions + registers
-
diff --git a/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h b/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h
index 90a4413ee0e..32d9c232259 100644
--- a/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h
+++ b/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.5 2020/02/21 21:52:24 tnn Exp $
+$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.6 2022/03/13 15:50:05 tnn Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
@@ -6,9 +6,9 @@ with dlopen(3) at the moment.
table_noop_array is only defined for shared-glapi.
es1api and es2api are not going to be patched for NetBSD.
---- src/mapi/entry_x86-64_tls.h.orig 2019-12-04 22:10:14.000000000 +0000
+--- src/mapi/entry_x86-64_tls.h.orig 2021-07-14 20:04:57.805030000 +0000
+++ src/mapi/entry_x86-64_tls.h
-@@ -32,21 +32,33 @@
+@@ -38,22 +38,34 @@
#endif
__asm__(".text\n"
@@ -37,6 +37,7 @@ es1api and es2api are not going to be patched for NetBSD.
+ "jmp *(8 * " slot ")(%rax)"
+#else
#define STUB_ASM_CODE(slot) \
+ ENDBR \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
"movq %fs:(%rax), %r11\n\t" \
"jmp *(8 * " slot ")(%r11)"
@@ -44,7 +45,7 @@ es1api and es2api are not going to be patched for NetBSD.
#else
-@@ -77,7 +89,7 @@ x86_64_entry_start[] HIDDEN;
+@@ -85,7 +97,7 @@ x86_64_entry_start[] HIDDEN;
mapi_func
entry_get_public(int slot)
{
diff --git a/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h b/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h
index 8bd714d3c58..c618f8b753e 100644
--- a/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h
+++ b/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h
@@ -1,11 +1,11 @@
-$NetBSD: patch-src_mapi_entry__x86__tls.h,v 1.6 2020/03/08 10:35:03 tnn Exp $
+$NetBSD: patch-src_mapi_entry__x86__tls.h,v 1.7 2022/03/13 15:50:05 tnn Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
---- src/mapi/entry_x86_tls.h.orig 2020-03-05 21:34:32.000000000 +0000
+--- src/mapi/entry_x86_tls.h.orig 2021-07-14 20:04:57.805030000 +0000
+++ src/mapi/entry_x86_tls.h
-@@ -45,6 +45,25 @@ __asm__("x86_current_tls:\n\t"
+@@ -51,6 +51,25 @@ __asm__("x86_current_tls:\n\t"
"movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t"
"ret");
@@ -31,7 +31,7 @@ with dlopen(3) at the moment.
#ifndef GLX_X86_READONLY_TEXT
__asm__(".section wtext, \"awx\", @progbits");
#endif /* GLX_X86_READONLY_TEXT */
-@@ -58,6 +77,11 @@ __asm__(".balign 16\n"
+@@ -64,6 +83,11 @@ __asm__(".balign 16\n"
".balign 16\n" \
func ":"
@@ -41,9 +41,9 @@ with dlopen(3) at the moment.
+ "jmp *(4 * " slot ")(%eax)"
+#else
#define STUB_ASM_CODE(slot) \
+ ENDBR \
"call 1f\n" \
- "1:\n\t" \
-@@ -66,6 +90,7 @@ __asm__(".balign 16\n"
+@@ -73,6 +97,7 @@ __asm__(".balign 16\n"
"movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t" \
"movl %gs:(%eax), %eax\n\t" \
"jmp *(4 * " slot ")(%eax)"
diff --git a/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_glX__XML.py b/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_glX__XML.py
deleted file mode 100644
index 2ae4dc1673d..00000000000
--- a/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_glX__XML.py
+++ /dev/null
@@ -1,25 +0,0 @@
-$NetBSD: patch-src_mapi_glapi_gen_glX__XML.py,v 1.1 2021/01/06 15:50:02 triaxx Exp $
-
-Remove deprecated .getchildren() that are no longer supported in Python 3.9.
-https://cgit.freedesktop.org/mesa/mesa/commit/src/mapi/glapi/gen/glX_XML.py?id=7a680
-
---- src/mapi/glapi/gen/glX_XML.py.orig 2021-01-06 15:15:12.263181000 +0100
-+++ src/mapi/glapi/gen/glX_XML.py
-@@ -48,7 +48,7 @@
-
- self.functions = {}
-
-- for child in element.getchildren():
-+ for child in element:
- if child.tag == "size":
- n = child.get( "name" )
- c = child.get( "count" )
-@@ -130,7 +130,7 @@
- self.counter_list.append(param.counter)
-
-
-- for child in element.getchildren():
-+ for child in element:
- if child.tag == "glx":
- rop = child.get( 'rop' )
- sop = child.get( 'sop' )
diff --git a/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__XML.py b/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__XML.py
deleted file mode 100644
index cd10c7d3cc3..00000000000
--- a/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__XML.py
+++ /dev/null
@@ -1,43 +0,0 @@
-$NetBSD: patch-src_mapi_glapi_gen_gl__XML.py,v 1.1 2021/01/06 15:50:02 triaxx Exp $
-
-Remove deprecated .getchildren() that are no longer supported in Python 3.9.
-https://cgit.freedesktop.org/mesa/mesa/commit/src/mapi/glapi/gen/gl_XML.py?id=7a680
-
---- src/mapi/glapi/gen/gl_XML.py.orig 2021-01-06 15:17:59.922890000 +0100
-+++ src/mapi/glapi/gen/gl_XML.py
-@@ -713,7 +713,7 @@
-
- parameters = []
- return_type = "void"
-- for child in element.getchildren():
-+ for child in element:
- if child.tag == "return":
- return_type = child.get( "type", "void" )
- elif child.tag == "param":
-@@ -743,7 +743,7 @@
- if param.is_image():
- self.images.append( param )
-
-- if element.getchildren():
-+ if list(element):
- self.initialized = 1
- self.entry_point_parameters[name] = parameters
- else:
-@@ -873,7 +873,7 @@
-
-
- def process_OpenGLAPI(self, file_name, element):
-- for child in element.getchildren():
-+ for child in element:
- if child.tag == "category":
- self.process_category( child )
- elif child.tag == "OpenGLAPI":
-@@ -893,7 +893,7 @@
- [cat_type, key] = classify_category(cat_name, cat_number)
- self.categories[cat_type][key] = [cat_name, cat_number]
-
-- for child in cat.getchildren():
-+ for child in cat:
- if child.tag == "function":
- func_name = real_function_name( child )
-
diff --git a/graphics/MesaLib/patches/patch-src_mapi_u__current.c b/graphics/MesaLib/patches/patch-src_mapi_u__current.c
index 65f80835f3b..08debe911eb 100644
--- a/graphics/MesaLib/patches/patch-src_mapi_u__current.c
+++ b/graphics/MesaLib/patches/patch-src_mapi_u__current.c
@@ -1,23 +1,23 @@
-$NetBSD: patch-src_mapi_u__current.c,v 1.3 2019/10/18 09:57:07 nia Exp $
+$NetBSD: patch-src_mapi_u__current.c,v 1.4 2022/03/13 15:50:05 tnn Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
---- src/mapi/u_current.c.orig 2019-10-09 16:52:00.000000000 +0000
+--- src/mapi/u_current.c.orig 2021-08-04 18:49:29.246474300 +0000
+++ src/mapi/u_current.c
@@ -101,7 +101,11 @@ extern void (*__glapi_noop_table[])(void
+ #if defined(USE_ELF_TLS)
- __thread struct _glapi_table *u_current_table
- __attribute__((tls_model("initial-exec")))
+ __THREAD_INITIAL_EXEC struct _glapi_table *u_current_table
+#if defined(__NetBSD__)
+ = NULL; /* non-zero initializers not supported with dlopen */
+#else
= (struct _glapi_table *) table_noop_array;
+#endif
- __thread void *u_current_context
- __attribute__((tls_model("initial-exec")));
-@@ -283,7 +287,11 @@ struct _glapi_table *
+ __THREAD_INITIAL_EXEC void *u_current_context;
+
+@@ -251,7 +255,11 @@ struct _glapi_table *
u_current_get_table_internal(void)
{
#if defined(USE_ELF_TLS)
diff --git a/graphics/MesaLib/patches/patch-src_mapi_u__current.h b/graphics/MesaLib/patches/patch-src_mapi_u__current.h
deleted file mode 100644
index 5c3e0e65336..00000000000
--- a/graphics/MesaLib/patches/patch-src_mapi_u__current.h
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-src_mapi_u__current.h,v 1.3 2019/10/18 09:57:07 nia Exp $
-
-NetBSD only supports zero-initialized initial-exec tls variables in conjuction
-with dlopen(3) at the moment.
-
---- src/mapi/u_current.h.orig 2019-10-09 16:52:00.000000000 +0000
-+++ src/mapi/u_current.h
-@@ -65,7 +65,7 @@ u_current_get_context_internal(void);
- static inline const struct _glapi_table *
- u_current_get_table(void)
- {
--#ifdef USE_ELF_TLS
-+#if defined(USE_ELF_TLS) && !defined(__NetBSD__)
- return u_current_table;
- #else
- return (likely(u_current_table) ?
diff --git a/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c b/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c
index c1983bdc91e..f81644d9010 100644
--- a/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c
+++ b/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c
@@ -1,13 +1,13 @@
-$NetBSD: patch-src_mesa_main_extensions.c,v 1.2 2019/08/21 13:35:28 nia Exp $
+$NetBSD: patch-src_mesa_main_extensions.c,v 1.3 2022/03/13 15:50:05 tnn Exp $
atexit() is not a good idea in shared libraries.
FreeBSD reported atexit bug for 10.6:
https://bugs.freedesktop.org/show_bug.cgi?id=91869
---- src/mesa/main/extensions.c.orig 2018-02-09 02:17:59.000000000 +0000
+--- src/mesa/main/extensions.c.orig 2021-07-14 20:04:58.316035000 +0000
+++ src/mesa/main/extensions.c
-@@ -203,7 +203,11 @@ set_extension(struct gl_extensions *ext,
+@@ -213,7 +213,11 @@ set_extension(struct gl_extensions *ext,
* This string is allocated early during the first context creation by
* _mesa_one_time_init_extension_overrides.
*/
@@ -18,11 +18,11 @@ https://bugs.freedesktop.org/show_bug.cgi?id=91869
+#endif
free_unknown_extensions_strings(void)
{
- free(unrecognized_extensions);
-@@ -293,7 +297,9 @@ _mesa_one_time_init_extension_overrides(
+ free(unrecognized_extensions.env);
+@@ -304,7 +308,9 @@ _mesa_one_time_init_extension_overrides(
free(env);
} else {
- unrecognized_extensions = env;
+ unrecognized_extensions.env = env;
+#if !defined(HAVE_NOATEXIT)
atexit(free_unknown_extensions_strings);
+#endif
diff --git a/graphics/MesaLib/patches/patch-src_mesa_main_macros.h b/graphics/MesaLib/patches/patch-src_mesa_main_macros.h
deleted file mode 100644
index fdda0491be1..00000000000
--- a/graphics/MesaLib/patches/patch-src_mesa_main_macros.h
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-src_mesa_main_macros.h,v 1.2 2019/08/21 13:35:28 nia Exp $
-
-ALIGN is also defined in sys/param.h on NetBSD.
-
-Extend undefining ALIGN to all other OSes.
-
---- src/mesa/main/macros.h.orig 2017-11-10 23:18:56.000000000 +0000
-+++ src/mesa/main/macros.h
-@@ -677,6 +677,9 @@ minify(unsigned value, unsigned levels)
- *
- * \sa ROUND_DOWN_TO()
- */
-+#ifdef ALIGN
-+#undef ALIGN
-+#endif
- static inline uintptr_t
- ALIGN(uintptr_t value, int32_t alignment)
- {
diff --git a/graphics/MesaLib/patches/patch-src_mesa_main_marshal.h b/graphics/MesaLib/patches/patch-src_mesa_main_marshal.h
deleted file mode 100644
index cc75fa1d192..00000000000
--- a/graphics/MesaLib/patches/patch-src_mesa_main_marshal.h
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-src_mesa_main_marshal.h,v 1.1 2020/01/18 21:29:05 triaxx Exp $
-
-ALIGN is also defined in machine/param.h on FreetBSD.
-
---- src/mesa/main/marshal.h.orig 2019-12-04 22:10:14.000000000 +0000
-+++ src/mesa/main/marshal.h
-@@ -55,6 +55,9 @@ _mesa_glthread_allocate_command(struct gl_context *ctx
- struct glthread_state *glthread = ctx->GLThread;
- struct glthread_batch *next = &glthread->batches[glthread->next];
- struct marshal_cmd_base *cmd_base;
-+#ifdef ALIGN
-+#undef ALIGN
-+#endif
- const size_t aligned_size = ALIGN(size, 8);
-
- if (unlikely(next->used + size > MARSHAL_MAX_CMD_SIZE)) {
diff --git a/graphics/MesaLib/patches/patch-src_util_u__queue.c b/graphics/MesaLib/patches/patch-src_util_u__queue.c
index 68d8f2f09e0..efaacbebace 100644
--- a/graphics/MesaLib/patches/patch-src_util_u__queue.c
+++ b/graphics/MesaLib/patches/patch-src_util_u__queue.c
@@ -1,13 +1,13 @@
-$NetBSD: patch-src_util_u__queue.c,v 1.2 2020/03/08 10:35:03 tnn Exp $
+$NetBSD: patch-src_util_u__queue.c,v 1.3 2022/03/13 15:50:05 tnn Exp $
atexit() is not a good idea in shared libraries.
FreeBSD reported atexit bug for 10.6:
https://bugs.freedesktop.org/show_bug.cgi?id=91869
---- src/util/u_queue.c.orig 2020-03-05 21:34:32.000000000 +0000
+--- src/util/u_queue.c.orig 2021-07-14 20:04:59.260044300 +0000
+++ src/util/u_queue.c
-@@ -51,11 +51,22 @@ static once_flag atexit_once_flag = ONCE
+@@ -58,11 +58,22 @@ static once_flag atexit_once_flag = ONCE
static struct list_head queue_list;
static mtx_t exit_mutex = _MTX_INITIALIZER_NP;
@@ -30,7 +30,7 @@ https://bugs.freedesktop.org/show_bug.cgi?id=91869
mtx_lock(&exit_mutex);
/* Wait for all queues to assert idle. */
LIST_FOR_EACH_ENTRY(iter, &queue_list, head) {
-@@ -68,7 +79,11 @@ static void
+@@ -75,7 +86,11 @@ static void
global_init(void)
{
list_inithead(&queue_list);
@@ -42,29 +42,3 @@ https://bugs.freedesktop.org/show_bug.cgi?id=91869
}
static void
-@@ -249,12 +264,25 @@ util_queue_thread_func(void *input)
- /* Don't inherit the thread affinity from the parent thread.
- * Set the full mask.
- */
-+#if defined(__NetBSD__)
-+ cpuset_t *cpuset;
-+ cpuset = cpuset_create();
-+ if (cpuset != NULL) {
-+ cpuset_zero(cpuset);
-+ for (unsigned i = 0; i < cpuset_size(cpuset); i++)
-+ cpuset_set(i, cpuset);
-+
-+ pthread_setaffinity_np(pthread_self(), cpuset_size(cpuset), cpuset);
-+ cpuset_destroy(cpuset);
-+ }
-+#else
- cpu_set_t cpuset;
- CPU_ZERO(&cpuset);
- for (unsigned i = 0; i < CPU_SETSIZE; i++)
- CPU_SET(i, &cpuset);
-
- pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
-+#endif
- }
- #endif
-
diff --git a/graphics/MesaLib/patches/patch-src_util_u__thread.h b/graphics/MesaLib/patches/patch-src_util_u__thread.h
index 64db83fb096..d4e6882b489 100644
--- a/graphics/MesaLib/patches/patch-src_util_u__thread.h
+++ b/graphics/MesaLib/patches/patch-src_util_u__thread.h
@@ -1,95 +1,69 @@
-$NetBSD: patch-src_util_u__thread.h,v 1.4 2020/03/08 10:35:03 tnn Exp $
+$NetBSD: patch-src_util_u__thread.h,v 1.5 2022/03/13 15:50:05 tnn Exp $
Oracle Solaris has pthread_setname_np. illumos does not.
+(actually, newer Illumos does have it, but never mind.)
Don't hard error when there's no pthread_setname_np.
handle NetBSD-style pthread_setaffinity_np(3)
---- src/util/u_thread.h.orig 2020-03-05 21:34:32.000000000 +0000
+--- src/util/u_thread.h.orig 2021-08-04 18:49:29.374474500 +0000
+++ src/util/u_thread.h
-@@ -73,7 +73,7 @@ static inline thrd_t u_thread_create(int
+@@ -129,7 +129,7 @@ static inline thrd_t u_thread_create(int
static inline void u_thread_setname( const char *name )
{
#if defined(HAVE_PTHREAD)
-#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS
+#if DETECT_OS_LINUX || DETECT_OS_CYGWIN
- pthread_setname_np(pthread_self(), name);
- #elif DETECT_OS_FREEBSD || DETECT_OS_OPENBSD
- pthread_set_name_np(pthread_self(), name);
-@@ -104,6 +104,17 @@ static inline void
- util_pin_thread_to_L3(thrd_t thread, unsigned L3_index, unsigned cores_per_L3)
+ int ret = pthread_setname_np(pthread_self(), name);
+ if (ret == ERANGE) {
+ char buf[16];
+@@ -169,8 +169,32 @@ util_set_thread_affinity(thrd_t thread,
+ unsigned num_mask_bits)
{
#if defined(HAVE_PTHREAD_SETAFFINITY)
-+#if defined(__NetBSD__)
-+ cpuset_t *cpuset;
+- cpu_set_t cpuset;
++# if defined(__NetBSD__)
++ cpu_set_t *cpuset;
+ cpuset = cpuset_create();
+ if (cpuset == NULL)
+ return;
-+ cpuset_zero(cpuset);
-+ for (unsigned i = 0; i < cores_per_L3; i++)
-+ cpuset_set(L3_index * cores_per_L3 + i, cpuset);
-+ pthread_setaffinity_np(thread, cpuset_size(cpuset), cpuset);
-+ cpuset_destroy(cpuset);
-+#else
- cpu_set_t cpuset;
++ if (old_mask) {
++ if (pthread_getaffinity_np(thread, cpuset_size(cpuset), cpuset) != 0)
++ return false;
- CPU_ZERO(&cpuset);
-@@ -111,6 +122,7 @@ util_pin_thread_to_L3(thrd_t thread, uns
- CPU_SET(L3_index * cores_per_L3 + i, &cpuset);
- pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset);
- #endif
-+#endif
- }
-
- /**
-@@ -124,6 +136,35 @@ static inline int
- util_get_L3_for_pinned_thread(thrd_t thread, unsigned cores_per_L3)
- {
- #if defined(HAVE_PTHREAD_SETAFFINITY)
-+#if defined(__NetBSD__)
-+ cpuset_t *cpuset;
-+
-+ cpuset = cpuset_create();
-+ if (cpuset == NULL)
-+ return -1;
-+
-+ if (pthread_getaffinity_np(thread, cpuset_size(cpuset), cpuset) == 0) {
-+ int L3_index = -1;
-+
-+ for (unsigned i = 0; i < cpuset_size(cpuset); i++) {
-+ if (cpuset_isset(i, cpuset)) {
-+ int x = i / cores_per_L3;
-+
-+ if (L3_index != x) {
-+ if (L3_index == -1)
-+ L3_index = x;
-+ else {
-+ cpuset_destroy(cpuset);
-+ return -1; /* multiple L3s are set */
-+ }
-+ }
-+ }
++ memset(old_mask, 0, num_mask_bits / 8);
++ for (unsigned i = 0; i < num_mask_bits && i < CPU_SETSIZE; i++) {
++ if (cpuset_isset(i, cpuset))
++ old_mask[i / 32] |= 1u << (i % 32);
+ }
-+ cpuset_destroy(cpuset);
-+ return L3_index;
+ }
++
++ cpuset_zero(cpuset);
++ for (unsigned i = 0; i < num_mask_bits && i < CPU_SETSIZE; i++) {
++ if (mask[i / 32] & (1u << (i % 32)))
++ cpuset_set(i, cpuset);
++ }
++ int err = pthread_setaffinity_np(thread, cpuset_size(cpuset), cpuset);
+ cpuset_destroy(cpuset);
-+#else
- cpu_set_t cpuset;
-
- if (pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset) == 0) {
-@@ -144,6 +185,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
- return L3_index;
++ return err == 0;
++# else
++ cpu_set_t cpuset;
+ if (old_mask) {
+ if (pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset) != 0)
+ return false;
+@@ -188,7 +212,7 @@ util_set_thread_affinity(thrd_t thread,
+ CPU_SET(i, &cpuset);
}
- #endif
-+#endif
- return -1;
- }
+ return pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset) == 0;
+-
++# endif
+ #elif defined(_WIN32) && !defined(__CYGWIN__)
+ DWORD_PTR m = mask[0];
-@@ -155,7 +197,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
+@@ -242,7 +266,7 @@ util_set_current_thread_affinity(const u
static inline int64_t
- u_thread_get_time_nano(thrd_t thread)
+ util_thread_get_time_nano(thrd_t thread)
{
-#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__)
+#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__sun)