Previously, the cache would be removed if created by an application for a different architecture, e.g. i386 rather than amd64 on a multiarch installation. This is due to use of the libraries' build datestamps.
This makes use of the canonicalisation done by config.sub. --- configure.ac | 14 ++++++++++++++ src/util/disk_cache.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) To fix up the documentation, https://patchwork.freedesktop.org/patch/141595/ is needed. diff --git a/configure.ac b/configure.ac index 890a379..91fabf2 100644 --- a/configure.ac +++ b/configure.ac @@ -1055,6 +1055,20 @@ if test "x$enable_gallium_extra_hud" = xyes ; then DEFINES="${DEFINES} -DHAVE_GALLIUM_EXTRA_HUD=1" fi +# Architecture name for shader cache +# Should be canonical for all but i386, so just canonicalise that +case "$host_cpu" in +i[456]86) + CACHE_ARCH=i386 + ;; +*) + CACHE_ARCH="$host_cpu" + ;; +esac +if test "x$CACHE_ARCH" != x; then + DEFINES="${DEFINES} -DCACHE_ARCH=\\\"$CACHE_ARCH\\\"" +fi + #TODO: no pkgconfig .pc available for libsensors. #PKG_CHECK_MODULES([LIBSENSORS], [libsensors >= $LIBSENSORS_REQUIRED], [enable_lmsensors=yes], [enable_lmsensors=no]) AC_ARG_ENABLE([lmsensors], diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index f5e1145..87e62fd 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -54,6 +54,11 @@ /* The number of keys that can be stored in the index. */ #define CACHE_INDEX_MAX_KEYS (1 << CACHE_INDEX_KEY_BITS) +/* Default cache architecture name */ +#ifndef CACHE_ARCH +#define CACHE_ARCH "unknown_arch" +#endif + struct disk_cache { /* The path to the cache directory. */ char *path; @@ -175,6 +180,15 @@ create_mesa_cache_dir(void *mem_ctx, char *path, const char *timestamp, if (new_path == NULL) return NULL; + /* Create a parent architecture directory so that we don't remove cache + * files for other architectures. In theory we could share the cache + * between architectures but we have no way of knowing if they were created + * by a compatible Mesa version. + */ + new_path = concatenate_and_mkdir(mem_ctx, new_path, CACHE_ARCH); + if (new_path == NULL) + return NULL; + /* Remove cache directories for old Mesa versions */ remove_old_cache_directories(mem_ctx, new_path, timestamp); -- | _ | Darren Salt, using Debian GNU/Linux (and Android) | ( ) | | X | ASCII Ribbon campaign against HTML e-mail | / \ | _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev