From 445887f636e75d6d057d8d46980d442d7f1cd02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Wed, 21 Sep 2022 09:36:02 -0300 Subject: [PATCH] mesa: 22.1.7 -> 22.2.1 --- .../libraries/mesa/aarch64-darwin.patch | 33 --------------- pkgs/development/libraries/mesa/default.nix | 25 +++-------- ...include-dri-driver-path-in-cache-key.patch | 42 ++++++++----------- .../libraries/mesa/drop-dri2.patch | 40 ------------------ pkgs/development/libraries/mesa/opencl.patch | 9 ++-- 5 files changed, 27 insertions(+), 122 deletions(-) delete mode 100644 pkgs/development/libraries/mesa/aarch64-darwin.patch delete mode 100644 pkgs/development/libraries/mesa/drop-dri2.patch diff --git a/pkgs/development/libraries/mesa/aarch64-darwin.patch b/pkgs/development/libraries/mesa/aarch64-darwin.patch deleted file mode 100644 index e60a4ffa308a..000000000000 --- a/pkgs/development/libraries/mesa/aarch64-darwin.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8ac29b952e638ec1ea8c3734a3b91253e50c336d Mon Sep 17 00:00:00 2001 -From: Jeremy Huddleston Sequoia -Date: Sun, 24 Jan 2021 21:10:29 -0800 -Subject: [PATCH 4/4] Hack to address build failure when using newer macOS SDKs - with older deployment targets - -Signed-off-by: Jeremy Huddleston Sequoia ---- - include/c11/threads_posix.h | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h -index 45cb6075e6e..355d725f7da 100644 ---- a/include/c11/threads_posix.h -+++ b/include/c11/threads_posix.h -@@ -382,7 +382,13 @@ tss_set(tss_t key, void *val) - - /*-------------------- 7.25.7 Time functions --------------------*/ - // 7.25.6.1 --#ifndef HAVE_TIMESPEC_GET -+#if !defined(HAVE_TIMESPEC_GET) || defined(__APPLE__) -+ -+#ifdef __APPLE__ -+#include -+#define timespec_get(ts, b) mesa_timespec_get(ts, b) -+#endif -+ - static inline int - timespec_get(struct timespec *ts, int base) - { --- -2.29.2 (Apple Git-129) - diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 65dd547c6ab7..977a22e00467 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -5,7 +5,7 @@ , llvmPackages, libffi, libomxil-bellagio, libva-minimal , libelf, libvdpau , libglvnd, libunwind -, vulkan-loader +, vulkan-loader, glslang , galliumDrivers ? ["auto"] , vulkanDrivers ? ["auto"] , eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" ] @@ -34,7 +34,7 @@ with lib; let # Release calendar: https://www.mesa3d.org/release-calendar.html # Release frequency: https://www.mesa3d.org/releasing.html#schedule - version = "22.1.7"; + version = "22.2.1"; branch = versions.major version; self = stdenv.mkDerivation { @@ -43,12 +43,13 @@ self = stdenv.mkDerivation { src = fetchurl { urls = [ + "https://archive.mesa3d.org/mesa-${version}.tar.xz" "https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz" "ftp://ftp.freedesktop.org/pub/mesa/mesa-${version}.tar.xz" "ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-${version}.tar.xz" "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz" ]; - sha256 = "da838eb2cf11d0e08d0e9944f6bd4d96987fdc59ea2856f8c70a31a82b355d89"; + sha256 = "0079beac0a33f45e7e0aec59e6913eafbc4268a3f1e2e330017440494f91b13c"; }; # TODO: @@ -57,25 +58,9 @@ self = stdenv.mkDerivation { patches = [ # fixes pkgsMusl.mesa build ./musl.patch - (fetchpatch { - url = "https://raw.githubusercontent.com/void-linux/void-packages/b9f58f303ae23754c95d5d1fe87a98b5a2d8f271/srcpkgs/mesa/patches/musl-endian.patch"; - hash = "sha256-eRc91qCaFlVzrxFrNUPpAHd1gsqKsLCCN0IW8pBQcqk="; - }) - (fetchpatch { - url = "https://raw.githubusercontent.com/void-linux/void-packages/b9f58f303ae23754c95d5d1fe87a98b5a2d8f271/srcpkgs/mesa/patches/musl-stacksize.patch"; - hash = "sha256-bEp0AWddsw1Pc3rxdKN8fsrX4x2TQEzMUa5afhLXGsg="; - }) ./opencl.patch ./disk_cache-include-dri-driver-path-in-cache-key.patch - ] ++ optionals (stdenv.isDarwin && stdenv.isAarch64) [ - # Fix aarch64-darwin build, remove when upstreaam supports it out of the box. - # See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1020 - ./aarch64-darwin.patch - ] ++ optionals stdenv.isDarwin [ - # 22.1 on darwin won't build: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6519 - # (already in-tree for 22.2) - ./drop-dri2.patch ]; postPatch = '' @@ -153,7 +138,7 @@ self = stdenv.mkDerivation { meson pkg-config ninja intltool bison flex file python3Packages.python python3Packages.Mako - jdupes + jdupes glslang ] ++ lib.optionals (elem "wayland" eglPlatforms) [ wayland-scanner ]; diff --git a/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch b/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch index fa78f4ae730a..445f26c6bd10 100644 --- a/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch +++ b/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch @@ -1,21 +1,16 @@ -From 980164fd92f5c2302624cd046d30ff21e6e4ba8a Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Mon, 6 Aug 2018 15:52:11 -0300 -Subject: [PATCH] disk_cache: include dri driver path in cache key +Author: David McFarland +Date: Mon Aug 6 15:52:11 2018 -0300 -This fixes invalid cache hits on NixOS where all shared library -timestamps in /nix/store are zero. ---- - meson_options.txt | 6 ++++++ - src/util/disk_cache.c | 3 +++ - src/util/meson.build | 7 ++++++- - 3 files changed, 15 insertions(+), 1 deletion(-) + [PATCH] disk_cache: include dri driver path in cache key + + This fixes invalid cache hits on NixOS where all shared library + timestamps in /nix/store are zero. diff --git a/meson_options.txt b/meson_options.txt -index 2d39d13b6ad..daf06480a60 100644 +index b8f753e2e1a..70d9071c8be 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -368,6 +368,12 @@ option( +@@ -452,6 +452,12 @@ option( value : true, description : 'Enable direct rendering in GLX and EGL for DRI', ) @@ -25,14 +20,14 @@ index 2d39d13b6ad..daf06480a60 100644 + value : '', + description : 'Mesa cache key.' +) - option( - 'prefer-iris', - type : 'boolean', + option('egl-lib-suffix', + type : 'string', + value : '', diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c -index a92d621927a..3bd65c6890c 100644 +index 8dbe0938d11..498fe42de70 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c -@@ -401,8 +401,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, +@@ -194,8 +194,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, /* Create driver id keys */ size_t id_size = strlen(driver_id) + 1; @@ -43,7 +38,7 @@ index a92d621927a..3bd65c6890c 100644 cache->driver_keys_blob_size += gpu_name_size; /* We sometimes store entire structs that contains a pointers in the cache, -@@ -423,6 +425,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id, +@@ -216,6 +218,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id, uint8_t *drv_key_blob = cache->driver_keys_blob; DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size) DRV_KEY_CPY(drv_key_blob, driver_id, id_size) @@ -52,13 +47,13 @@ index a92d621927a..3bd65c6890c 100644 DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size) DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size) diff --git a/src/util/meson.build b/src/util/meson.build -index 0893f64793b..d46ce85a85f 100644 +index cd44e49bfb4..f17115515a5 100644 --- a/src/util/meson.build +++ b/src/util/meson.build -@@ -179,7 +179,12 @@ _libmesa_util = static_library( +@@ -268,7 +268,12 @@ _libmesa_util = static_library( include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], dependencies : deps_for_libmesa_util, - link_with: libmesa_format, + link_with: [libmesa_format, libmesa_util_sse41], - c_args : [c_msvc_compat_args], + c_args : [ + c_msvc_compat_args, @@ -69,6 +64,3 @@ index 0893f64793b..d46ce85a85f 100644 gnu_symbol_visibility : 'hidden', build_by_default : false ) --- -2.28.0 - diff --git a/pkgs/development/libraries/mesa/drop-dri2.patch b/pkgs/development/libraries/mesa/drop-dri2.patch deleted file mode 100644 index 8c2b85a55aae..000000000000 --- a/pkgs/development/libraries/mesa/drop-dri2.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/a/src/gallium/frontends/dri/dri_util.c b/b/src/gallium/frontends/dri/dri_util.c -index 8d60526..782360d 100644 ---- a/src/gallium/frontends/dri/dri_util.c -+++ b/src/gallium/frontends/dri/dri_util.c -@@ -808,35 +808,6 @@ const __DRIcoreExtension driCoreExtension = { - .unbindContext = driUnbindContext - }; - --/** DRI2 interface */ --const __DRIdri2Extension driDRI2Extension = { -- .base = { __DRI_DRI2, 4 }, -- -- .createNewScreen = dri2CreateNewScreen, -- .createNewDrawable = driCreateNewDrawable, -- .createNewContext = driCreateNewContext, -- .getAPIMask = driGetAPIMask, -- .createNewContextForAPI = driCreateNewContextForAPI, -- .allocateBuffer = dri2AllocateBuffer, -- .releaseBuffer = dri2ReleaseBuffer, -- .createContextAttribs = driCreateContextAttribs, -- .createNewScreen2 = driCreateNewScreen2, --}; -- --const __DRIdri2Extension swkmsDRI2Extension = { -- .base = { __DRI_DRI2, 4 }, -- -- .createNewScreen = swkmsCreateNewScreen, -- .createNewDrawable = driCreateNewDrawable, -- .createNewContext = driCreateNewContext, -- .getAPIMask = driGetAPIMask, -- .createNewContextForAPI = driCreateNewContextForAPI, -- .allocateBuffer = dri2AllocateBuffer, -- .releaseBuffer = dri2ReleaseBuffer, -- .createContextAttribs = driCreateContextAttribs, -- .createNewScreen2 = driCreateNewScreen2, --}; -- - const __DRIswrastExtension driSWRastExtension = { - .base = { __DRI_SWRAST, 4 }, - diff --git a/pkgs/development/libraries/mesa/opencl.patch b/pkgs/development/libraries/mesa/opencl.patch index ce6e3d575085..d220239770d5 100644 --- a/pkgs/development/libraries/mesa/opencl.patch +++ b/pkgs/development/libraries/mesa/opencl.patch @@ -1,5 +1,5 @@ diff --git a/meson_options.txt b/meson_options.txt -index a7030aba31e..1d2d8814992 100644 +index b8f753e2e1a..2163e3ab7ee 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,6 +18,12 @@ @@ -16,7 +16,7 @@ index a7030aba31e..1d2d8814992 100644 'platforms', type : 'array', diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build -index b77826b6e1e..14fa9ba7177 100644 +index 14df6b86f7f..adcd5110342 100644 --- a/src/gallium/targets/opencl/meson.build +++ b/src/gallium/targets/opencl/meson.build @@ -30,6 +30,7 @@ if with_ld_version_script @@ -60,11 +60,12 @@ index b77826b6e1e..14fa9ba7177 100644 polly_dep, polly_isl_dep, ] # check clang once more -@@ -120,6 +121,6 @@ if with_opencl_icd +@@ -112,7 +113,7 @@ if with_opencl_icd input : 'mesa.icd.in', output : 'mesa.icd', install : true, - install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'), + install_dir : join_paths(get_option('prefix'), 'etc', 'OpenCL', 'vendors'), ) - endif + + if meson.version().version_compare('>= 0.58')