pkgsrc-Changes archive

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

CVS commit: pkgsrc/graphics/MesaLib/patches



Module Name:    pkgsrc
Committed By:   tnn
Date:           Sun Mar 13 15:52:50 UTC 2022

Added Files:
        pkgsrc/graphics/MesaLib/patches: patch-src_drm-shim_drm__shim.c
            patch-src_gallium_drivers_freedreno_freedreno__screen.c
            patch-src_gallium_drivers_freedreno_freedreno__util.h
            patch-src_gallium_frontends_clover_util_range.hpp
            patch-src_gallium_frontends_osmesa_osmesa.c
            patch-src_glx_dri__common.c patch-src_mesa_main_context.c
            patch-src_mesa_main_formats.c patch-src_util_disk__cache__os.c
            patch-src_util_libsync.h patch-src_util_u__printf.h
            patch-src_util_u__process.c

Log Message:
MesaLib: add patches for prior 21.3.7 update


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c \
    pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c \
    pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h \
    pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp \
    pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c \
    pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.c \
    pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_formats.c \
    pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache__os.c \
    pkgsrc/graphics/MesaLib/patches/patch-src_util_libsync.h \
    pkgsrc/graphics/MesaLib/patches/patch-src_util_u__printf.h \
    pkgsrc/graphics/MesaLib/patches/patch-src_util_u__process.c
cvs rdiff -u -r0 -r1.6 \
    pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c

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

Added files:

Index: pkgsrc/graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_drm-shim_drm__shim.c      Sun Mar 13 15:52:50 2022
@@ -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. */
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c     Sun Mar 13 15:52:50 2022
@@ -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));
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_freedreno_freedreno__util.h       Sun Mar 13 15:52:50 2022
@@ -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 {                                                                        \
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_clover_util_range.hpp   Sun Mar 13 15:52:50 2022
@@ -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)... };
+    }
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c Sun Mar 13 15:52:50 2022
@@ -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) {
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.c Sun Mar 13 15:52:50 2022
@@ -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);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_formats.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_formats.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_formats.c       Sun Mar 13 15:52:50 2022
@@ -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
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache__os.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache__os.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache__os.c    Sun Mar 13 15:52:50 2022
@@ -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)
+       if (dir_ent->d_type == DT_REG) { /* If the entry is a regular file */
+          total_file_count++;
+       }
++#else
++      total_file_count++;
++#endif
+    }
+ 
+    /* Reset to the start of the directory */
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_libsync.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_libsync.h:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_libsync.h    Sun Mar 13 15:52:50 2022
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_util_libsync.h,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+sys/ioccom.h for _IOWR
+
+--- src/util/libsync.h.orig    2022-01-12 21:32:28.000000000 +0000
++++ src/util/libsync.h
+@@ -34,6 +34,9 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <sys/ioctl.h>
++#ifdef __sun__
++#include <sys/ioccom.h>
++#endif
+ #include <sys/poll.h>
+ #include <unistd.h>
+ 
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_u__printf.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_u__printf.h:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_u__printf.h  Sun Mar 13 15:52:50 2022
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_util_u__printf.h,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+include cstdarg for va_list
+
+--- src/util/u_printf.h.orig   2021-12-01 19:04:14.000000000 +0000
++++ src/util/u_printf.h
+@@ -25,6 +25,7 @@
+ #ifdef __cplusplus
+ 
+ #include <string>
++#include <cstdarg>
+ 
+ /* find next valid printf specifier in a C++ std::string */
+ size_t util_printf_next_spec_pos(const std::string &s, size_t pos);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_u__process.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_u__process.c:1.1
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_u__process.c Sun Mar 13 15:52:50 2022
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_util_u__process.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/util/u_process.c.orig  2021-07-14 20:04:59.260044300 +0000
++++ src/util/u_process.c
+@@ -48,9 +48,15 @@
+ 
+ static char *path = NULL;
+ 
+-static void __freeProgramPath()
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
++static void
++#endif
++__freeProgramPath()
+ {
+-   free(path);
++   if (path)
++     free(path);
+    path = NULL;
+ }
+ 
+@@ -68,7 +74,9 @@ __getProgramName()
+        */
+       if (!path) {
+          path = realpath("/proc/self/exe", NULL);
++#if !defined(HAVE_NOATEXIT)
+          atexit(__freeProgramPath);
++#endif
+       }
+ 
+       if (path && strncmp(path, program_invocation_name, strlen(path)) == 0) {

Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c:1.6
--- /dev/null   Sun Mar 13 15:52:50 2022
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c       Sun Mar 13 15:52:50 2022
@@ -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) {



Home | Main Index | Thread Index | Old Index