lol
at 18.09-beta 52 lines 1.9 kB view raw
1From 9c9df280b318c26aece9873cf77b32e4f95634c1 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 src/util/Makefile.am | 3 +++ 10 src/util/disk_cache.c | 3 +++ 11 2 files changed, 6 insertions(+) 12 13diff --git a/src/util/Makefile.am b/src/util/Makefile.am 14index 07bf052175..aea09f60b3 100644 15--- a/src/util/Makefile.am 16+++ b/src/util/Makefile.am 17@@ -30,6 +30,9 @@ noinst_LTLIBRARIES = \ 18 libmesautil.la \ 19 libxmlconfig.la 20 21+AM_CFLAGS = \ 22+ -DDISK_CACHE_KEY=\"$(drivers)\" 23+ 24 AM_CPPFLAGS = \ 25 $(PTHREAD_CFLAGS) \ 26 -I$(top_srcdir)/include 27diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c 28index 4a762eff20..8086c0be75 100644 29--- a/src/util/disk_cache.c 30+++ b/src/util/disk_cache.c 31@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *timestamp, 32 33 /* Create driver id keys */ 34 size_t ts_size = strlen(timestamp) + 1; 35+ size_t key_size = strlen(DISK_CACHE_KEY) + 1; 36 size_t gpu_name_size = strlen(gpu_name) + 1; 37 cache->driver_keys_blob_size += ts_size; 38+ cache->driver_keys_blob_size += key_size; 39 cache->driver_keys_blob_size += gpu_name_size; 40 41 /* We sometimes store entire structs that contains a pointers in the cache, 42@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *timestamp, 43 uint8_t *drv_key_blob = cache->driver_keys_blob; 44 DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size) 45 DRV_KEY_CPY(drv_key_blob, timestamp, ts_size) 46+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size) 47 DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size) 48 DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size) 49 DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size) 50-- 512.18.0 52