Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.05 74 lines 2.6 kB view raw
1From 980164fd92f5c2302624cd046d30ff21e6e4ba8a Mon Sep 17 00:00:00 2001 2From: David McFarland <corngood@gmail.com> 3Date: Mon, 6 Aug 2018 15:52:11 -0300 4Subject: [PATCH] disk_cache: include dri driver path in cache key 5 6This fixes invalid cache hits on NixOS where all shared library 7timestamps in /nix/store are zero. 8--- 9 meson_options.txt | 6 ++++++ 10 src/util/disk_cache.c | 3 +++ 11 src/util/meson.build | 7 ++++++- 12 3 files changed, 15 insertions(+), 1 deletion(-) 13 14diff --git a/meson_options.txt b/meson_options.txt 15index 2d39d13b6ad..daf06480a60 100644 16--- a/meson_options.txt 17+++ b/meson_options.txt 18@@ -368,6 +368,12 @@ option( 19 value : true, 20 description : 'Enable direct rendering in GLX and EGL for DRI', 21 ) 22+option( 23+ 'disk-cache-key', 24+ type : 'string', 25+ value : '', 26+ description : 'Mesa cache key.' 27+) 28 option( 29 'prefer-iris', 30 type : 'boolean', 31diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c 32index a92d621927a..3bd65c6890c 100644 33--- a/src/util/disk_cache.c 34+++ b/src/util/disk_cache.c 35@@ -401,8 +401,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 36 37 /* Create driver id keys */ 38 size_t id_size = strlen(driver_id) + 1; 39+ size_t key_size = strlen(DISK_CACHE_KEY) + 1; 40 size_t gpu_name_size = strlen(gpu_name) + 1; 41 cache->driver_keys_blob_size += id_size; 42+ cache->driver_keys_blob_size += key_size; 43 cache->driver_keys_blob_size += gpu_name_size; 44 45 /* We sometimes store entire structs that contains a pointers in the cache, 46@@ -423,6 +425,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 47 uint8_t *drv_key_blob = cache->driver_keys_blob; 48 DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size) 49 DRV_KEY_CPY(drv_key_blob, driver_id, id_size) 50+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size) 51 DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size) 52 DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size) 53 DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size) 54diff --git a/src/util/meson.build b/src/util/meson.build 55index 0893f64793b..d46ce85a85f 100644 56--- a/src/util/meson.build 57+++ b/src/util/meson.build 58@@ -179,7 +179,12 @@ _libmesa_util = static_library( 59 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 60 dependencies : deps_for_libmesa_util, 61 link_with: libmesa_format, 62- c_args : [c_msvc_compat_args], 63+ c_args : [ 64+ c_msvc_compat_args, 65+ '-DDISK_CACHE_KEY="@0@"'.format( 66+ get_option('disk-cache-key') 67+ ), 68+ ], 69 gnu_symbol_visibility : 'hidden', 70 build_by_default : false 71 ) 72-- 732.28.0 74