2020-10-25 21:17:24 +00:00
|
|
|
From 980164fd92f5c2302624cd046d30ff21e6e4ba8a 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.
|
|
|
|
---
|
2019-03-26 23:41:50 +00:00
|
|
|
meson_options.txt | 6 ++++++
|
2018-08-06 20:23:02 +01:00
|
|
|
src/util/disk_cache.c | 3 +++
|
2019-03-26 23:41:50 +00:00
|
|
|
src/util/meson.build | 7 ++++++-
|
|
|
|
3 files changed, 15 insertions(+), 1 deletion(-)
|
2018-08-06 20:23:02 +01:00
|
|
|
|
2019-03-26 23:41:50 +00:00
|
|
|
diff --git a/meson_options.txt b/meson_options.txt
|
2020-10-25 21:17:24 +00:00
|
|
|
index 2d39d13b6ad..daf06480a60 100644
|
2019-03-26 23:41:50 +00:00
|
|
|
--- a/meson_options.txt
|
|
|
|
+++ b/meson_options.txt
|
2020-10-25 21:17:24 +00:00
|
|
|
@@ -368,6 +368,12 @@ option(
|
2019-03-26 23:41:50 +00:00
|
|
|
value : true,
|
|
|
|
description : 'Enable direct rendering in GLX and EGL for DRI',
|
|
|
|
)
|
|
|
|
+option(
|
|
|
|
+ 'disk-cache-key',
|
|
|
|
+ type : 'string',
|
|
|
|
+ value : '',
|
|
|
|
+ description : 'Mesa cache key.'
|
|
|
|
+)
|
2020-01-03 16:57:49 +00:00
|
|
|
option(
|
2020-10-25 21:17:24 +00:00
|
|
|
'prefer-iris',
|
2020-01-03 16:57:49 +00:00
|
|
|
type : 'boolean',
|
2018-08-06 20:23:02 +01:00
|
|
|
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
|
2020-10-25 21:17:24 +00:00
|
|
|
index a92d621927a..3bd65c6890c 100644
|
2018-08-06 20:23:02 +01:00
|
|
|
--- a/src/util/disk_cache.c
|
|
|
|
+++ b/src/util/disk_cache.c
|
2020-10-25 21:17:24 +00:00
|
|
|
@@ -401,8 +401,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,
|
2020-10-25 21:17:24 +00:00
|
|
|
@@ -423,6 +425,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)
|
2019-03-26 23:41:50 +00:00
|
|
|
diff --git a/src/util/meson.build b/src/util/meson.build
|
2020-10-25 21:17:24 +00:00
|
|
|
index 0893f64793b..d46ce85a85f 100644
|
2019-03-26 23:41:50 +00:00
|
|
|
--- a/src/util/meson.build
|
|
|
|
+++ b/src/util/meson.build
|
2020-10-25 21:17:24 +00:00
|
|
|
@@ -179,7 +179,12 @@ _libmesa_util = static_library(
|
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2020-01-03 16:57:49 +00:00
|
|
|
dependencies : deps_for_libmesa_util,
|
2020-03-11 13:39:20 +00:00
|
|
|
link_with: libmesa_format,
|
2020-10-25 21:17:24 +00:00
|
|
|
- c_args : [c_msvc_compat_args],
|
2019-03-26 23:41:50 +00:00
|
|
|
+ c_args : [
|
2020-10-25 21:17:24 +00:00
|
|
|
+ c_msvc_compat_args,
|
2019-03-26 23:41:50 +00:00
|
|
|
+ '-DDISK_CACHE_KEY="@0@"'.format(
|
|
|
|
+ get_option('disk-cache-key')
|
|
|
|
+ ),
|
|
|
|
+ ],
|
2020-10-25 21:17:24 +00:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-26 23:41:50 +00:00
|
|
|
build_by_default : false
|
|
|
|
)
|
2018-08-06 20:23:02 +01:00
|
|
|
--
|
2020-10-25 21:17:24 +00:00
|
|
|
2.28.0
|
|
|
|
|