pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/graphics/MesaLib/patches MesaLib: add patches for prio...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/90ceb05deeea
branches:  trunk
changeset: 375398:90ceb05deeea
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sun Mar 13 15:52:50 2022 +0000

description:
MesaLib: add patches for prior 21.3.7 update

diffstat:

 graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c                          |  28 ++++++
 graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c |  30 +++++++
 graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h   |  31 +++++++
 graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp       |  40 +++++++++
 graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c             |  29 +++++++
 graphics/MesaLib/patches/patch-src_glx_dri__common.c                             |  41 ++++++++++
 graphics/MesaLib/patches/patch-src_mesa_main_context.c                           |  28 ++++++
 graphics/MesaLib/patches/patch-src_mesa_main_formats.c                           |  28 ++++++
 graphics/MesaLib/patches/patch-src_util_disk__cache__os.c                        |  18 ++++
 graphics/MesaLib/patches/patch-src_util_libsync.h                                |  16 +++
 graphics/MesaLib/patches/patch-src_util_u__printf.h                              |  14 +++
 graphics/MesaLib/patches/patch-src_util_u__process.c                             |  34 ++++++++
 12 files changed, 337 insertions(+), 0 deletions(-)

diffs (truncated from 385 to 300 lines):

diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c   Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_drm-shim_drm__shim.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/drm-shim/drm_shim.c.orig       2021-07-14 20:04:46.724922400 +0000
++++ src/drm-shim/drm_shim.c
+@@ -162,7 +162,11 @@ drm_shim_override_file(const char *conte
+    override->contents = strdup(contents);
+ }
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ destroy_shim(void)
+ {
+    _mesa_set_destroy(opendir_set, NULL);
+@@ -227,7 +231,9 @@ init_shim(void)
+ 
+    drm_shim_device_init();
+ 
++#if !defined(HAVE_NOATEXIT)
+    atexit(destroy_shim);
++#endif
+ }
+ 
+ /* Override libdrm's reading of various sysfs files for device enumeration. */
diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c  Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_gallium_drivers_freedreno_freedreno__screen.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+sysinfo(2) is for Linux only
+
+--- src/gallium/drivers/freedreno/freedreno_screen.c.orig      2021-12-01 19:04:14.000000000 +0000
++++ src/gallium/drivers/freedreno/freedreno_screen.c
+@@ -43,7 +43,9 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include "drm-uapi/drm_fourcc.h"
++#if !defined(__NetBSD__)
+ #include <sys/sysinfo.h>
++#endif
+ 
+ #include "freedreno_fence.h"
+ #include "freedreno_perfetto.h"
+@@ -1020,9 +1022,13 @@ fd_screen_create(struct fd_device *dev, 
+    driParseConfigFiles(config->options, config->options_info, 0, "msm",
+                        NULL, fd_dev_name(screen->dev_id), NULL, 0, NULL, 0);
+ 
++#if defined(__NetBSD__)
++   screen->ram_size = 512 * 1024 * 1024; /* XXX should use sysctl hw.physmem64 here */
++#else
+    struct sysinfo si;
+    sysinfo(&si);
+    screen->ram_size = si.totalram;
++#endif
+ 
+    DBG("Pipe Info:");
+    DBG(" GPU-id:          %s", fd_dev_name(screen->dev_id));
diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h    Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_gallium_drivers_freedreno_freedreno__util.h,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+gettid() is linux-specific
+
+--- src/gallium/drivers/freedreno/freedreno_util.h.orig        2022-01-12 21:32:28.000000000 +0000
++++ src/gallium/drivers/freedreno/freedreno_util.h
+@@ -108,6 +108,7 @@ extern bool fd_binning_enabled;
+ #include <sys/types.h>
+ #include <sys/syscall.h>
+ 
++#if defined(__linux__)
+ #define DBG(fmt, ...)                                                          \
+    do {                                                                        \
+       if (FD_DBG(MSGS))                                                        \
+@@ -115,6 +116,16 @@ extern bool fd_binning_enabled;
+                                         __FUNCTION__, __LINE__,                \
+                                         ##__VA_ARGS__);                        \
+    } while (0)
++#else
++#define DBG(fmt, ...)                                                          \
++   do {                                                                        \
++      if (FD_DBG(MSGS))                                                        \
++         mesa_logi("%s:%d: " fmt,                                              \
++                                        __FUNCTION__, __LINE__,                \
++                                        ##__VA_ARGS__);                        \
++   } while (0)
++#endif
++
+ 
+ #define perf_debug_message(debug, type, ...)                                   \
+    do {                                                                        \
diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp        Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_gallium_frontends_clover_util_range.hpp,v 1.1 2022/03/13 15:52:50 tnn 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/frontends/clover/util/range.hpp.orig   2021-07-14 20:04:53.703990500 +0000
++++ src/gallium/frontends/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 -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c      Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_gallium_frontends_osmesa_osmesa.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/gallium/frontends/osmesa/osmesa.c.orig 2021-07-14 20:04:55.420007000 +0000
++++ src/gallium/frontends/osmesa/osmesa.c
+@@ -134,7 +134,11 @@ osmesa_st_get_param(struct st_manager *s
+ static struct st_manager *stmgr = NULL;
+ static struct st_api *stapi = NULL;
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ destroy_st_manager(void)
+ {
+    if (stmgr) {
+@@ -151,8 +155,10 @@ destroy_st_manager(void)
+ static void
+ create_st_manager(void)
+ {
++#if !defined(HAVE_NOATEXIT)
+    if (atexit(destroy_st_manager) != 0)
+       return;
++#endif
+ 
+    stmgr = CALLOC_STRUCT(st_manager);
+    if (stmgr) {
diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_glx_dri__common.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_glx_dri__common.c      Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,41 @@
+$NetBSD: patch-src_glx_dri__common.c,v 1.1 2022/03/13 15:52:50 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/glx/dri_common.c.orig  2021-07-14 20:04:55.743010300 +0000
++++ src/glx/dri_common.c
+@@ -690,9 +690,19 @@ 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;
+@@ -777,7 +787,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 -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_mesa_main_context.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_mesa_main_context.c    Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_mesa_main_context.c,v 1.6 2022/03/13 15:52:50 tnn Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/mesa/main/context.c.orig       2021-07-14 20:04:58.296035000 +0000
++++ src/mesa/main/context.c
+@@ -324,7 +324,11 @@ _mesa_destroy_visual( struct gl_config *
+  * Calls all the various one-time-fini functions in Mesa
+  */
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ one_time_fini(void)
+ {
+    glsl_type_singleton_decref();
+@@ -357,7 +361,9 @@ one_time_init(void)
+       _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+    }
+ 
++#if !defined(HAVE_NOATEXIT)
+    atexit(one_time_fini);
++#endif
+ 
+ #if defined(DEBUG)
+    if (MESA_VERBOSE != 0) {
diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_mesa_main_formats.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_mesa_main_formats.c    Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_mesa_main_formats.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/mesa/main/formats.c.orig       2021-07-14 20:04:58.323035200 +0000
++++ src/mesa/main/formats.c
+@@ -451,7 +451,11 @@ _mesa_format_to_array_format(mesa_format
+ static struct hash_table *format_array_format_table;
+ static once_flag format_array_format_table_exists = ONCE_FLAG_INIT;
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ format_array_format_table_destroy(void)
+ {
+    _mesa_hash_table_destroy(format_array_format_table, NULL);
+@@ -496,7 +500,9 @@ format_array_format_table_init(void)
+                                          (void *)(intptr_t)f);
+    }
+ 
++#if !defined(HAVE_NOATEXIT)
+    atexit(format_array_format_table_destroy);
++#endif
+ }
+ 
+ mesa_format
diff -r 3ce2bc4c6d4f -r 90ceb05deeea graphics/MesaLib/patches/patch-src_util_disk__cache__os.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_util_disk__cache__os.c Sun Mar 13 15:52:50 2022 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_util_disk__cache__os.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+--- src/util/disk_cache_os.c.orig      2021-12-29 21:05:19.000000000 +0000
++++ src/util/disk_cache_os.c
+@@ -167,9 +167,13 @@ choose_lru_file_matching(const char *dir
+    /* First count the number of files in the directory */
+    unsigned total_file_count = 0;
+    while ((dir_ent = readdir(dir)) != NULL) {
++#if defined(DT_REG)



Home | Main Index | Thread Index | Old Index