From a5b186211705dd005a57a7e4ddfb5354c03dad1b Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Tue, 23 Jun 2026 15:51:37 -0300 Subject: [PATCH] FHS F2.1: mesa_shader_cache -> /var/cache/mesa First migration of the Class C cache work: the Mesa shader cache moves from the LibreELEC-style /storage/.cache/mesa_shader_cache to the Arch-standard /var/cache/mesa. Implementation follows the bridge-symlink pattern systemd already uses for /etc/*: the archr meta-package creates /var/cache/mesa as a build-time symlink into /storage/.cache/mesa_shader_cache. Mesa, runemu.sh and any inspector see the FHS path; writes still land on the storage overlay so the cache survives reboots. archr/package.mk: mkdir /var/cache, ln -sf the symlink. quirks/profile.d/041-panfrost: MESA_SHADER_CACHE_DIR=/var/cache/mesa. Comment explains the bridge so future readers do not assume tmpfs. runemu.sh: create the cache dir through /var/cache/mesa instead of the legacy /storage path. Comment updated to mention the symlink. systemd/tmpfiles.d/z_01_archr.conf is intentionally left targeting the backing path /storage/.cache/mesa_shader_cache: it is internal plumbing that must guarantee the real overlay dir exists; /var/cache/mesa is the surface, /storage/.cache/mesa_shader_cache stays the substrate. Co-Authored-By: Claude Opus 4.7 --- projects/ArchR/packages/archr/package.mk | 6 ++++++ projects/ArchR/packages/archr/sources/scripts/runemu.sh | 5 ++++- .../ArchR/packages/hardware/quirks/profile.d/041-panfrost | 8 +++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/projects/ArchR/packages/archr/package.mk b/projects/ArchR/packages/archr/package.mk index e80b6bc952..cd7699e561 100644 --- a/projects/ArchR/packages/archr/package.mk +++ b/projects/ArchR/packages/archr/package.mk @@ -46,6 +46,12 @@ EOF # Always install the update script mkdir -p $INSTALL/usr/share/bootloader find_file_path bootloader/update.sh && cp -av ${FOUND_PATH} ${INSTALL}/usr/share/bootloader + + ### FHS bridge symlinks: make Arch-standard cache locations resolve into + ### the /storage overlay. Apps and inspection tools see /var/cache/; + ### writes land in /storage/.cache/ (rw overlay). + mkdir -p ${INSTALL}/var/cache + ln -sf /storage/.cache/mesa_shader_cache ${INSTALL}/var/cache/mesa } post_install() { diff --git a/projects/ArchR/packages/archr/sources/scripts/runemu.sh b/projects/ArchR/packages/archr/sources/scripts/runemu.sh index 2f5e43a850..57974e0e3c 100755 --- a/projects/ArchR/packages/archr/sources/scripts/runemu.sh +++ b/projects/ArchR/packages/archr/sources/scripts/runemu.sh @@ -419,7 +419,10 @@ get_gpu_performance_level >/tmp/.gpu_performance_level ### root path itself when MESA_SHADER_CACHE_DIR points somewhere new; the ### result is silent fall-through to "no cache" and a stutter every time ### the user re-launches a game whose shaders should already be hot. -[ -d /storage/.cache/mesa_shader_cache ] || mkdir -p /storage/.cache/mesa_shader_cache 2>/dev/null +### /var/cache/mesa is a symlink into /storage/.cache/mesa_shader_cache +### installed by the archr meta-package; create through the symlink so +### the underlying overlay path exists. +[ -d /var/cache/mesa ] || mkdir -p /var/cache/mesa 2>/dev/null if [ "${DEVICE_HAS_FAN}" = "true" ] then diff --git a/projects/ArchR/packages/hardware/quirks/profile.d/041-panfrost b/projects/ArchR/packages/hardware/quirks/profile.d/041-panfrost index 1c64c4abd3..4ddfa22a69 100644 --- a/projects/ArchR/packages/hardware/quirks/profile.d/041-panfrost +++ b/projects/ArchR/packages/hardware/quirks/profile.d/041-panfrost @@ -14,7 +14,9 @@ export PAN_MESA_DEBUG=forcepack # Skip GL error checking — emulators don't query glGetError defensively. export MESA_NO_ERROR=1 -# Persistent shader cache on /storage to survive reboots and avoid -# recompilation every launch. Mesa creates the dir on first write. -export MESA_SHADER_CACHE_DIR=/storage/.cache/mesa_shader_cache +# Persistent shader cache via the FHS bridge symlink set up by the +# archr meta-package: /var/cache/mesa -> /storage/.cache/mesa_shader_cache. +# Surfaces an Arch-friendly path while the writes still land on the rw +# storage overlay so the cache survives reboots. +export MESA_SHADER_CACHE_DIR=/var/cache/mesa export MESA_SHADER_CACHE_MAX_SIZE=128MB