2018-10-20 02:42:21 +01:00
|
|
|
From 2a1e32b4105fe95413a615a44d40938920ea1a19 Mon Sep 17 00:00:00 2001
|
2018-08-06 20:23:02 +01:00
|
|
|
From: David McFarland <corngood@gmail.com>
|
|
|
|
Date: Mon, 6 Aug 2018 15:52:11 -0300
|
|
|
|
Subject: [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.
|
|
|
|
---
|
|
|
|
src/util/Makefile.am | 3 +++
|
|
|
|
src/util/disk_cache.c | 3 +++
|
|
|
|
2 files changed, 6 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
|
2018-10-20 02:42:21 +01:00
|
|
|
index bafb57439a..a22e2e41eb 100644
|
2018-08-06 20:23:02 +01:00
|
|
|
--- a/src/util/Makefile.am
|
|
|
|
+++ b/src/util/Makefile.am
|
2018-10-20 02:42:21 +01:00
|
|
|
@@ -35,6 +35,9 @@ noinst_LTLIBRARIES = \
|
2018-08-06 20:23:02 +01:00
|
|
|
libmesautil.la \
|
|
|
|
libxmlconfig.la
|
|
|
|
|
|
|
|
+AM_CFLAGS = \
|
|
|
|
+ -DDISK_CACHE_KEY=\"$(drivers)\"
|
|
|
|
+
|
|
|
|
AM_CPPFLAGS = \
|
|
|
|
$(PTHREAD_CFLAGS) \
|
|
|
|
-I$(top_srcdir)/include
|
|
|
|
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
|
2018-10-20 02:42:21 +01:00
|
|
|
index 368ec41792..071220b2ba 100644
|
2018-08-06 20:23:02 +01:00
|
|
|
--- a/src/util/disk_cache.c
|
|
|
|
+++ b/src/util/disk_cache.c
|
2018-10-20 02:42:21 +01:00
|
|
|
@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
|
2018-08-06 20:23:02 +01:00
|
|
|
|
|
|
|
/* Create driver id keys */
|
2018-10-20 02:42:21 +01:00
|
|
|
size_t id_size = strlen(driver_id) + 1;
|
2018-08-06 20:23:02 +01:00
|
|
|
+ size_t key_size = strlen(DISK_CACHE_KEY) + 1;
|
|
|
|
size_t gpu_name_size = strlen(gpu_name) + 1;
|
2018-10-20 02:42:21 +01:00
|
|
|
cache->driver_keys_blob_size += id_size;
|
2018-08-06 20:23:02 +01:00
|
|
|
+ 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,
|
2018-10-20 02:42:21 +01:00
|
|
|
@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
|
2018-08-06 20:23:02 +01:00
|
|
|
uint8_t *drv_key_blob = cache->driver_keys_blob;
|
|
|
|
DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
|
2018-10-20 02:42:21 +01:00
|
|
|
DRV_KEY_CPY(drv_key_blob, driver_id, id_size)
|
2018-08-06 20:23:02 +01:00
|
|
|
+ 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)
|
|
|
|
--
|
2018-10-20 02:42:21 +01:00
|
|
|
2.19.1
|
2018-08-06 20:23:02 +01:00
|
|
|
|