pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/graphics/mesa



Module Name:    pkgsrc
Committed By:   wiz
Date:           Mon Nov 30 09:08:28 UTC 2026

Modified Files:
        pkgsrc/graphics/mesa: Makefile distinfo
Added Files:
        pkgsrc/graphics/mesa/patches: patch-src_drm-shim_drm__shim.c
            patch-src_egl_main_eglglobals.c patch-src_glx_dri__common.c
            patch-src_mesa_main_context.c patch-src_mesa_main_extensions.c
            patch-src_mesa_main_formats.c patch-src_util_u__process.c
            patch-src_util_u__queue.c

Log Message:
mesa: carry over atexit() patches from MesaLib, simplified

Fixes coredumps on exit.

Reported upstream, let's see what happens.

XXX: there are a couple more atexit() locations remaining that might
need patching as well.

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 pkgsrc/graphics/mesa/Makefile
cvs rdiff -u -r1.7 -r1.8 pkgsrc/graphics/mesa/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/graphics/mesa/patches/patch-src_drm-shim_drm__shim.c \
    pkgsrc/graphics/mesa/patches/patch-src_egl_main_eglglobals.c \
    pkgsrc/graphics/mesa/patches/patch-src_glx_dri__common.c \
    pkgsrc/graphics/mesa/patches/patch-src_mesa_main_context.c \
    pkgsrc/graphics/mesa/patches/patch-src_mesa_main_extensions.c \
    pkgsrc/graphics/mesa/patches/patch-src_mesa_main_formats.c \
    pkgsrc/graphics/mesa/patches/patch-src_util_u__process.c \
    pkgsrc/graphics/mesa/patches/patch-src_util_u__queue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/graphics/mesa/Makefile
diff -u pkgsrc/graphics/mesa/Makefile:1.8 pkgsrc/graphics/mesa/Makefile:1.9
--- pkgsrc/graphics/mesa/Makefile:1.8   Sat Nov 28 22:07:06 2026
+++ pkgsrc/graphics/mesa/Makefile       Mon Nov 30 09:08:27 2026
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.8 2026/11/28 22:07:06 wiz Exp $
+# $NetBSD: Makefile,v 1.9 2026/11/30 09:08:27 wiz Exp $
 #
 # needs recursive bumps for _every_ update due to
 # lib/libgallium-${PKGVERSION}.so
 
 DISTNAME=      mesa-26.3.1
+PKGREVISION=   1
 CATEGORIES=    graphics
 MASTER_SITES=  https://mesa.freedesktop.org/archive/
 MASTER_SITES+= https://mesa3d.org/archive/

Index: pkgsrc/graphics/mesa/distinfo
diff -u pkgsrc/graphics/mesa/distinfo:1.7 pkgsrc/graphics/mesa/distinfo:1.8
--- pkgsrc/graphics/mesa/distinfo:1.7   Mon Nov 30 07:37:24 2026
+++ pkgsrc/graphics/mesa/distinfo       Mon Nov 30 09:08:27 2026
@@ -1,19 +1,27 @@
-$NetBSD: distinfo,v 1.7 2026/11/30 07:37:24 wiz Exp $
+$NetBSD: distinfo,v 1.8 2026/11/30 09:08:27 wiz Exp $
 
 BLAKE2s (mesa-26.3.1.tar.xz) = fc011f0c8dda9d33b2d606e624c187cc6b1d6f15dcaa0df72fac6bd919cb0682
 SHA512 (mesa-26.3.1.tar.xz) = 9d56fe98a0b3199f671363c1e3c195eaf5a7465cff6b4fddf6663ca2272537f950b666c466468f5e94318d660f6ef503c4e523feda42c0d1ef89b31392a26272
 Size (mesa-26.3.1.tar.xz) = 91661844 bytes
 SHA1 (patch-meson.build) = ec79ae9343e4f05263ee7c1235d02efd28c224fc
+SHA1 (patch-src_drm-shim_drm__shim.c) = d51b5a84d9dbf6764a20a737069f3c7cc0852598
+SHA1 (patch-src_egl_main_eglglobals.c) = fc92b7bc669e29498840dc832ddafb9fde5e8347
 SHA1 (patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c) = 79dfeaf6a9edeed7b0f02f7a99174f32b15a7cde
 SHA1 (patch-src_gallium_auxiliary_vl_vl__csc.c) = 4a67a1ca8ffc10171ccd60123d4222970e5b7a6e
 SHA1 (patch-src_gallium_drivers_r600_sfn_sfn__valuefactory.cpp) = dce7340ac40e0d32e6ee00288538b30dc5d7d526
+SHA1 (patch-src_glx_dri__common.c) = 8a9ab237c68a72e8978da80a4a6341a823991afb
 SHA1 (patch-src_glx_glxclient.h) = 4812c1b17bfff6cb43192790aa5cfee5c6c3149d
 SHA1 (patch-src_glx_glxcurrent.c) = be95c084b834275ca65a38f446487c68889e1ab5
 SHA1 (patch-src_intel_compiler_brw_brw__print.cpp) = 31ae4d70d0cb3b857f8a797259425b0f8e70c705
 SHA1 (patch-src_intel_compiler_gen_gen__private.h) = a45ad64b465ba0bc55b55bdecc35e75eae797af4
+SHA1 (patch-src_mesa_main_context.c) = 802948567301e822d364533baf887e1d0603e172
+SHA1 (patch-src_mesa_main_extensions.c) = 230f0c5ca603a330b565d9d40ce6475e04c037fc
+SHA1 (patch-src_mesa_main_formats.c) = 354d454f2d3202204e37018e66fc7ee10f57e35e
 SHA1 (patch-src_util_build__id.c) = 7a9547bbda9d2fb9f0018ccf27b70b59e497aa2c
 SHA1 (patch-src_util_futex.c) = 4ad0d60e008fe8b5a4bb600e32e8f155d6c95b37
 SHA1 (patch-src_util_futex.h) = a4a2827406102d855bb8afadecb7ce5a42fd5ecd
 SHA1 (patch-src_util_os__file.c) = c80d88255a8f800d1e36fc199f3869ecdb61d203
+SHA1 (patch-src_util_u__process.c) = 14d529958d66859723172cc4cb84523d8ff6f7e7
+SHA1 (patch-src_util_u__queue.c) = b4b902b53e0b72d00da2b376f143da736805f21b
 SHA1 (patch-src_vulkan_wsi_wsi__common__wayland.c) = 1b8017f21855e01183a2343af64cf7fc8ca13ebe
 SHA1 (patch-src_x11_x11__display.c) = 79f70b5e8096c5e76871eb2d42ad3ad05ddff992

Added files:

Index: pkgsrc/graphics/mesa/patches/patch-src_drm-shim_drm__shim.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_drm-shim_drm__shim.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_drm-shim_drm__shim.c Mon Nov 30 09:08:27 2026
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_drm-shim_drm__shim.c,v 1.1 2026/11/30 09:08:27 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/drm-shim/drm_shim.c.orig       2026-11-30 08:45:50.961616441 +0000
++++ src/drm-shim/drm_shim.c
+@@ -217,7 +217,7 @@ drm_shim_inited(void)
+    return p_atomic_read(&inited);
+ }
+ 
+-static void
++static void __attribute__((__destructor__))
+ destroy_shim(void)
+ {
+    _mesa_set_destroy(opendir_set, NULL);
+@@ -271,8 +271,6 @@ init_shim(void)
+    }
+ 
+    drm_shim_device_init();
+-
+-   atexit(destroy_shim);
+ 
+    p_atomic_set(&inited, 1);
+    in_init = false;
Index: pkgsrc/graphics/mesa/patches/patch-src_egl_main_eglglobals.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_egl_main_eglglobals.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_egl_main_eglglobals.c        Mon Nov 30 09:08:27 2026
@@ -0,0 +1,43 @@
+$NetBSD: patch-src_egl_main_eglglobals.c,v 1.1 2026/11/30 09:08:27 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/egl/main/eglglobals.c.orig     2026-11-30 08:46:28.293194180 +0000
++++ src/egl/main/eglglobals.c
+@@ -47,6 +47,8 @@ static simple_mtx_t _eglGlobalMutex = SIMPLE_MTX_INITI
+ 
+ static simple_mtx_t _eglGlobalMutex = SIMPLE_MTX_INITIALIZER;
+ 
++static EGLBoolean registered = EGL_FALSE;
++
+ struct _egl_global _eglGlobal = {
+    .Mutex = &_eglGlobalMutex,
+    .DisplayList = NULL,
+@@ -100,9 +102,12 @@ struct _egl_global _eglGlobal = {
+    .debugTypesEnabled = _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR,
+ };
+ 
+-static void
++static void __attribute__((__destructor__))
+ _eglAtExit(void)
+ {
++   if (!registered)
++      return;
++
+    _eglFiniDisplay();
+    _eglFiniDevice(); /* always called last */
+ }
+@@ -110,12 +115,9 @@ _eglRegisterAtExit(void)
+ void
+ _eglRegisterAtExit(void)
+ {
+-   static EGLBoolean registered = EGL_FALSE;
+-
+    simple_mtx_lock(_eglGlobal.Mutex);
+ 
+    if (!registered) {
+-      atexit(_eglAtExit);
+       registered = EGL_TRUE;
+    }
+ 
Index: pkgsrc/graphics/mesa/patches/patch-src_glx_dri__common.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_glx_dri__common.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_glx_dri__common.c    Mon Nov 30 09:08:27 2026
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_glx_dri__common.c,v 1.1 2026/11/30 09:08:27 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/glx/dri_common.c.orig  2026-11-18 15:56:09.000000000 +0000
++++ src/glx/dri_common.c
+@@ -762,9 +762,13 @@ static struct driver_config_entry *driver_config_cache
+ /* Called as an atexit function. Otherwise, this would have to be called with
+  * driver_config_mutex locked.
+  */
+-static void
++static Bool e_next_ever_null = False;
++
++static void __attribute__((__destructor__))
+ clear_driver_config_cache()
+ {
++   if (!e_next_ever_null)
++      return;
+    while (driver_config_cache) {
+       struct driver_config_entry *e = driver_config_cache;
+       driver_config_cache = e->next;
+@@ -814,7 +818,7 @@ glXGetDriverConfig(const char *driverName)
+    driver_config_cache = e;
+ 
+    if (!e->next)
+-      atexit(clear_driver_config_cache);
++      e_next_ever_null = True;
+ 
+ out:
+    pthread_mutex_unlock(&driver_config_mutex);
Index: pkgsrc/graphics/mesa/patches/patch-src_mesa_main_context.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_mesa_main_context.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_mesa_main_context.c  Mon Nov 30 09:08:27 2026
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_mesa_main_context.c,v 1.1 2026/11/30 09:08:27 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/mesa/main/context.c.orig       2026-11-30 08:49:46.982640866 +0000
++++ src/mesa/main/context.c
+@@ -181,7 +181,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256];
+  * Calls all the various one-time-fini functions in Mesa
+  */
+ 
+-static void
++static void __attribute__((__destructor__))
+ one_time_fini(void)
+ {
+    glsl_type_singleton_decref();
+@@ -218,8 +218,6 @@ one_time_init(const char *extensions_override)
+    for (i = 0; i < 256; i++) {
+       _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+    }
+-
+-   atexit(one_time_fini);
+ 
+ #if MESA_DEBUG
+    if (MESA_VERBOSE != 0) {
Index: pkgsrc/graphics/mesa/patches/patch-src_mesa_main_extensions.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_mesa_main_extensions.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_mesa_main_extensions.c       Mon Nov 30 09:08:27 2026
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_mesa_main_extensions.c,v 1.1 2026/11/30 09:08:27 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/mesa/main/extensions.c.orig    2026-11-30 08:50:15.780789173 +0000
++++ src/mesa/main/extensions.c
+@@ -138,7 +138,7 @@ set_extension(struct gl_extensions *ext, int i, GLbool
+  * This string is allocated early during the first context creation by
+  * _mesa_one_time_init_extension_overrides.
+  */
+-static void
++static void __attribute__((__destructor__))
+ free_unknown_extensions_strings(void)
+ {
+    free(unrecognized_extensions.env);
+@@ -235,7 +235,6 @@ _mesa_one_time_init_extension_overrides(const char *ov
+       free(env);
+    } else {
+       unrecognized_extensions.env = env;
+-      atexit(free_unknown_extensions_strings);
+    }
+ }
+ 
Index: pkgsrc/graphics/mesa/patches/patch-src_mesa_main_formats.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_mesa_main_formats.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_mesa_main_formats.c  Mon Nov 30 09:08:28 2026
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_mesa_main_formats.c,v 1.1 2026/11/30 09:08:28 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/mesa/main/formats.c.orig       2026-11-30 08:50:39.761563717 +0000
++++ src/mesa/main/formats.c
+@@ -451,7 +451,7 @@ static once_flag format_array_format_table_exists = ON
+ static struct hash_table *format_array_format_table;
+ static once_flag format_array_format_table_exists = ONCE_FLAG_INIT;
+ 
+-static void
++static void __attribute__((__destructor__))
+ format_array_format_table_destroy(void)
+ {
+    _mesa_hash_table_destroy(format_array_format_table, NULL);
+@@ -495,8 +495,6 @@ format_array_format_table_init(void)
+                                          (void *)(intptr_t)array_format,
+                                          (void *)(intptr_t)f);
+    }
+-
+-   atexit(format_array_format_table_destroy);
+ }
+ 
+ mesa_format
Index: pkgsrc/graphics/mesa/patches/patch-src_util_u__process.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_util_u__process.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_util_u__process.c    Mon Nov 30 09:08:28 2026
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_util_u__process.c,v 1.1 2026/11/30 09:08:28 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/util/u_process.c.orig  2026-11-30 08:51:00.045687862 +0000
++++ src/util/u_process.c
+@@ -194,10 +194,11 @@ static char *program_name;
+ 
+ static char *program_name;
+ 
+-static void
++static void __attribute__((__destructor__))
+ free_program_name(void)
+ {
+-   free(program_name);
++   if (program_name)
++       free(program_name);
+    program_name = NULL;
+ }
+ 
+@@ -206,9 +207,6 @@ util_get_process_name_callback(void)
+ {
+    const char *override_name = os_get_option("MESA_PROCESS_NAME");
+    program_name = override_name ? strdup(override_name) : __getProgramName();
+-
+-   if (program_name)
+-      atexit(free_program_name);
+ }
+ 
+ const char *
Index: pkgsrc/graphics/mesa/patches/patch-src_util_u__queue.c
diff -u /dev/null pkgsrc/graphics/mesa/patches/patch-src_util_u__queue.c:1.1
--- /dev/null   Mon Nov 30 09:08:28 2026
+++ pkgsrc/graphics/mesa/patches/patch-src_util_u__queue.c      Mon Nov 30 09:08:28 2026
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_util_u__queue.c,v 1.1 2026/11/30 09:08:28 wiz Exp $
+
+avoid atexit in shared libraries.
+https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072
+
+--- src/util/u_queue.c.orig    2026-11-30 08:51:48.025676612 +0000
++++ src/util/u_queue.c
+@@ -55,6 +55,7 @@ util_queue_kill_threads_locked(struct util_queue *queu
+  * are using the static variables.
+  */
+ 
++static int global_init_called = 0;
+ static once_flag atexit_once_flag = ONCE_FLAG_INIT;
+ static struct list_head queue_list = {
+    .next = &queue_list,
+@@ -62,11 +63,14 @@ static mtx_t exit_mutex;
+ };
+ static mtx_t exit_mutex;
+ 
+-static void
++static void __attribute__((__destructor__))
+ atexit_handler(void)
+ {
+    struct util_queue *iter;
+ 
++   if (!global_init_called)
++      return;
++
+    mtx_lock(&exit_mutex);
+    /* Wait for all queues to assert idle. */
+    LIST_FOR_EACH_ENTRY(iter, &queue_list, head) {
+@@ -83,7 +87,7 @@ global_init(void)
+ global_init(void)
+ {
+    mtx_init(&exit_mutex, mtx_plain);
+-   atexit(atexit_handler);
++   global_init_called = 1;
+ }
+ 
+ static void



Home | Main Index | Thread Index | Old Index