summaryrefslogtreecommitdiff
path: root/modules/nixos/features/nvk/disk_cache-include-dri-driver-path-in-cache-key.patch
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos/features/nvk/disk_cache-include-dri-driver-path-in-cache-key.patch')
-rw-r--r--modules/nixos/features/nvk/disk_cache-include-dri-driver-path-in-cache-key.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/modules/nixos/features/nvk/disk_cache-include-dri-driver-path-in-cache-key.patch b/modules/nixos/features/nvk/disk_cache-include-dri-driver-path-in-cache-key.patch
new file mode 100644
index 0000000..bd19a9a
--- /dev/null
+++ b/modules/nixos/features/nvk/disk_cache-include-dri-driver-path-in-cache-key.patch
@@ -0,0 +1,67 @@
+Author: David McFarland <[email protected]>
+Date: Mon Aug 6 15:52:11 2018 -0300
+
+ [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 9639c516d49..c0bb86908ae 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -513,6 +513,13 @@ option(
+ description : 'Enable direct rendering in GLX and EGL for DRI',
+ )
+
++option(
++ 'disk-cache-key',
++ type : 'string',
++ value : '',
++ description : 'Mesa cache key.'
++)
++
+ option('egl-lib-suffix',
+ type : 'string',
+ value : '',
+diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
+index 8298f9d7b32..e622133f566 100644
+--- a/src/util/disk_cache.c
++++ b/src/util/disk_cache.c
+@@ -226,8 +226,10 @@ disk_cache_type_create(const char *gpu_name,
+
+ /* Create driver id keys */
+ size_t id_size = strlen(driver_id) + 1;
++ size_t key_size = strlen(DISK_CACHE_KEY) + 1;
+ size_t gpu_name_size = strlen(gpu_name) + 1;
+ cache->driver_keys_blob_size += id_size;
++ cache->driver_keys_blob_size += key_size;
+ cache->driver_keys_blob_size += gpu_name_size;
+
+ /* We sometimes store entire structs that contains a pointers in the cache,
+@@ -248,6 +250,7 @@ disk_cache_type_create(const char *gpu_name,
+ 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)
++ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
+ DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
+ 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 c0c1b9d1fa1..442163c5eac 100644
+--- a/src/util/meson.build
++++ b/src/util/meson.build
+@@ -268,7 +268,12 @@ _libmesa_util = static_library(
+ include_directories : [inc_util, include_directories('format')],
+ dependencies : deps_for_libmesa_util,
+ link_with: [libmesa_util_sse41],
+- c_args : [c_msvc_compat_args],
++ c_args : [
++ c_msvc_compat_args,
++ '-DDISK_CACHE_KEY="@0@"'.format(
++ get_option('disk-cache-key')
++ ),
++ ],
+ gnu_symbol_visibility : 'hidden',
+ build_by_default : false
+ )