Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1Author: David McFarland <corngood@gmail.com> 2Date: Mon Aug 6 15:52:11 2018 -0300 3 4 [PATCH] disk_cache: include dri driver path in cache key 5 6 This fixes invalid cache hits on NixOS where all shared library 7 timestamps in /nix/store are zero. 8 9diff --git a/meson_options.txt b/meson_options.txt 10index b8f753e2e1a..70d9071c8be 100644 11--- a/meson_options.txt 12+++ b/meson_options.txt 13@@ -452,7 +452,14 @@ option( 14 value : true, 15 description : 'Enable direct rendering in GLX and EGL for DRI', 16 ) 17 18+option( 19+ 'disk-cache-key', 20+ type : 'string', 21+ value : '', 22+ description : 'Mesa cache key.' 23+) 24+ 25 option('egl-lib-suffix', 26 type : 'string', 27 value : '', 28diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c 29index 8dbe0938d11..498fe42de70 100644 30--- a/src/util/disk_cache.c 31+++ b/src/util/disk_cache.c 32@@ -194,8 +194,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 33 34 /* Create driver id keys */ 35 size_t id_size = strlen(driver_id) + 1; 36+ size_t key_size = strlen(DISK_CACHE_KEY) + 1; 37 size_t gpu_name_size = strlen(gpu_name) + 1; 38 cache->driver_keys_blob_size += id_size; 39+ cache->driver_keys_blob_size += key_size; 40 cache->driver_keys_blob_size += gpu_name_size; 41 42 /* We sometimes store entire structs that contains a pointers in the cache, 43@@ -216,6 +218,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 44 uint8_t *drv_key_blob = cache->driver_keys_blob; 45 DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size) 46 DRV_KEY_CPY(drv_key_blob, driver_id, id_size) 47+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size) 48 DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size) 49 DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size) 50 DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size) 51diff --git a/src/util/meson.build b/src/util/meson.build 52index cd44e49bfb4..f17115515a5 100644 53--- a/src/util/meson.build 54+++ b/src/util/meson.build 55@@ -268,7 +268,12 @@ _libmesa_util = static_library( 56 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 57 dependencies : deps_for_libmesa_util, 58 link_with: [libmesa_format, libmesa_util_sse41], 59- c_args : [c_msvc_compat_args], 60+ c_args : [ 61+ c_msvc_compat_args, 62+ '-DDISK_CACHE_KEY="@0@"'.format( 63+ get_option('disk-cache-key') 64+ ), 65+ ], 66 gnu_symbol_visibility : 'hidden', 67 build_by_default : false 68 )