Enable vc4 and v3d for Raspberry Pi graphics in AlmaLinux (Resolves: https://github.com/AlmaLinux/raspberry-pi/issues/32)

This commit is contained in:
Koichiro Iwao 2026-03-12 15:41:30 +00:00 committed by root
commit d9ab7fa599
2 changed files with 193 additions and 2 deletions

View File

@ -0,0 +1,184 @@
From b51cf39cf40db4bfde0950483756ec09f6c21b39 Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Date: Tue, 25 Mar 2025 23:27:13 +0300
Subject: [PATCH] util/disk_cache: Re-enable multi-file cache by default
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Over past months a performance issue was found with the Mesa-DB cache
implementation that results in a too slow cache startup time when cache is
full. A better indexing strategy will need to be invented to mitigate the
issue. Until then, let's default back to the multi-file cache.
Suggested-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34199>
---
docs/envvars.rst | 32 +++++++++++++++++++++++---------
src/util/disk_cache.c | 10 ++++++----
src/util/tests/cache_test.cpp | 11 +++++++++++
3 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/docs/envvars.rst b/docs/envvars.rst
index 7247158cc50..3ea8415ca25 100644
--- a/docs/envvars.rst
+++ b/docs/envvars.rst
@@ -200,10 +200,11 @@ Core Mesa environment variables
.. envvar:: MESA_SHADER_CACHE_DIR
if set, determines the directory to be used for the on-disk cache of
- compiled shader programs. If this variable is not set, then the cache
- will be stored in ``$XDG_CACHE_HOME/mesa_shader_cache_db`` (if that
- variable is set), or else within ``.cache/mesa_shader_cache_db`` within
- the user's home directory.
+ compiled shader programs. If set then the cache will be stored in
+ ``$MESA_SHADER_CACHE_DIR/mesa_shader_cache``. If this variable is not
+ set, then the cache will be stored in
+ ``$XDG_CACHE_HOME/mesa_shader_cache`` (if that variable is set), or else
+ within ``.cache/mesa_shader_cache`` within the user's home directory.
.. envvar:: MESA_SHADER_CACHE_SHOW_STATS
@@ -226,11 +227,12 @@ Core Mesa environment variables
.. envvar:: MESA_DISK_CACHE_MULTI_FILE
- if set to 1, enables the multi file on-disk shader cache implementation
- instead of the default Mesa-DB cache implementation.
- This implementation increases the overall disk usage.
- If :envvar:`MESA_SHADER_CACHE_DIR` is not set, the cache will be stored
- in ``$XDG_CACHE_HOME/mesa_shader_cache`` (if that variable is set)
+ if set to 1 (set by default), enables the multi file on-disk
+ shader cache implementation. This implementation increases the overall
+ disk usage.
+ If :envvar:`MESA_SHADER_CACHE_DIR` is set, the cache will be stored in
+ ``$MESA_SHADER_CACHE_DIR/mesa_shader_cache``, or else within
+ ``$XDG_CACHE_HOME/mesa_shader_cache`` (if that variable is set)
or else within ``.cache/mesa_shader_cache`` within the user's home
directory.
@@ -245,6 +247,18 @@ Core Mesa environment variables
and ``filename1_idx.foz``. A limit of 8 DBs can be loaded and this limit
is shared with :envvar:`MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST`.
+.. envvar:: MESA_DISK_CACHE_DATABASE
+
+ if set to 1, enables the Mesa-DB single file on-disk shader cache
+ implementation instead of the default multi-file cache implementation.
+ Like :envvar:`MESA_DISK_CACHE_SINGLE_FILE`, Mesa-DB reduces overall
+ disk usage but Mesa-DB supports cache size limits via
+ :envvar:`MESA_SHADER_CACHE_MAX_SIZE`. If
+ :envvar:`MESA_SHADER_CACHE_DIR` is not set, the cache will be stored
+ in ``$XDG_CACHE_HOME/mesa_shader_cache_db`` (if that variable is set)
+ or else within ``.cache/mesa_shader_cache_db`` within the user's home
+ directory.
+
.. envvar:: MESA_DISK_CACHE_DATABASE_NUM_PARTS
specifies number of mesa-db cache parts, default is 50.
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 391f8cfdc1d..d62ba853179 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -223,17 +223,19 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
uint64_t max_size = 0;
char *max_size_str;
- if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false))
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false)) {
cache_type = DISK_CACHE_SINGLE_FILE;
- else if (debug_get_bool_option("MESA_DISK_CACHE_MULTI_FILE", false))
- cache_type = DISK_CACHE_MULTI_FILE;
- else {
+ } else if (debug_get_bool_option("MESA_DISK_CACHE_DATABASE", false)) {
cache_type = DISK_CACHE_DATABASE;
/* Since switching the default cache to <mesa_shader_cache_db>, remove the
* old cache folder if it hasn't been modified for more than 7 days.
*/
if (!getenv("MESA_SHADER_CACHE_DIR") && !getenv("MESA_GLSL_CACHE_DIR") && disk_cache_enabled())
disk_cache_delete_old_cache();
+ } else if (debug_get_bool_option("MESA_DISK_CACHE_MULTI_FILE", true)) {
+ cache_type = DISK_CACHE_MULTI_FILE;
+ } else {
+ return NULL;
}
max_size_str = getenv("MESA_SHADER_CACHE_MAX_SIZE");
diff --git a/src/util/tests/cache_test.cpp b/src/util/tests/cache_test.cpp
index f181178c809..d1772f3240f 100644
--- a/src/util/tests/cache_test.cpp
+++ b/src/util/tests/cache_test.cpp
@@ -819,7 +819,9 @@ TEST_F(Cache, Database)
#ifndef ENABLE_SHADER_CACHE
GTEST_SKIP() << "ENABLE_SHADER_CACHE not defined.";
#else
+ setenv("MESA_DISK_CACHE_MULTI_FILE", "false", 1);
setenv("MESA_DISK_CACHE_DATABASE_NUM_PARTS", "1", 1);
+ setenv("MESA_DISK_CACHE_DATABASE", "true", 1);
test_disk_cache_create(mem_ctx, CACHE_DIR_NAME_DB, driver_id);
@@ -845,6 +847,7 @@ TEST_F(Cache, Database)
test_put_big_sized_entry_to_empty_cache(driver_id);
+ setenv("MESA_DISK_CACHE_DATABASE", "false", 1);
unsetenv("MESA_DISK_CACHE_DATABASE_NUM_PARTS");
err = rmrf_local(CACHE_TEST_TMP);
@@ -872,6 +875,7 @@ TEST_F(Cache, Combined)
#else
setenv("MESA_DISK_CACHE_SINGLE_FILE", "true", 1);
setenv("MESA_DISK_CACHE_MULTI_FILE", "true", 1);
+ setenv("MESA_DISK_CACHE_DATABASE", "false", 1);
#ifdef SHADER_CACHE_DISABLE_BY_DEFAULT
setenv("MESA_SHADER_CACHE_DISABLE", "false", 1);
@@ -942,6 +946,7 @@ TEST_F(Cache, Combined)
setenv("MESA_DISK_CACHE_SINGLE_FILE", "false", 1);
setenv("MESA_DISK_CACHE_MULTI_FILE", "false", 1);
+ setenv("MESA_DISK_CACHE_DATABASE", "true", 1);
/* Create MESA-DB cache with enabled retrieval from the read-only
* cache. */
@@ -1010,6 +1015,7 @@ TEST_F(Cache, Combined)
disk_cache_destroy(cache_mesa_db);
/* Create default multi-file cache. */
+ setenv("MESA_DISK_CACHE_DATABASE", "false", 1);
setenv("MESA_DISK_CACHE_MULTI_FILE", "true", 1);
/* Enable read-only cache. */
@@ -1068,7 +1074,9 @@ TEST_F(Cache, Combined)
disk_cache_destroy(cache_multifile);
+ unsetenv("MESA_DISK_CACHE_SINGLE_FILE");
unsetenv("MESA_DISK_CACHE_MULTI_FILE");
+ unsetenv("MESA_DISK_CACHE_DATABASE");
int err = rmrf_local(CACHE_TEST_TMP);
EXPECT_EQ(err, 0) << "Removing " CACHE_TEST_TMP " again";
@@ -1325,13 +1333,16 @@ TEST_F(Cache, DatabaseMultipartEviction)
#ifndef ENABLE_SHADER_CACHE
GTEST_SKIP() << "ENABLE_SHADER_CACHE not defined.";
#else
+ setenv("MESA_DISK_CACHE_MULTI_FILE", "false", 1);
setenv("MESA_DISK_CACHE_DATABASE_NUM_PARTS", "3", 1);
+ setenv("MESA_DISK_CACHE_DATABASE", "true", 1);
test_disk_cache_create(mem_ctx, CACHE_DIR_NAME_DB, driver_id);
test_multipart_eviction(driver_id);
unsetenv("MESA_DISK_CACHE_DATABASE_NUM_PARTS");
+ unsetenv("MESA_DISK_CACHE_DATABASE");
int err = rmrf_local(CACHE_TEST_TMP);
EXPECT_EQ(err, 0) << "Removing " CACHE_TEST_TMP " again";
--
2.52.0

View File

@ -73,7 +73,7 @@ Name: mesa
Summary: Mesa graphics libraries
%global ver 25.0.7
Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)}
Release: 4%{?dist}.alma.1
Release: 5%{?dist}.alma.1
License: MIT AND BSD-3-Clause AND SGI-B-2.0
URL: http://www.mesa3d.org
@ -136,6 +136,10 @@ Patch12: 0001-glx-don-t-call-GL-functions-directly-use-the-current.patch
Patch60: 0001-drisw-Modify-drisw_swap_buffers_with_damage-to-swap-.patch
Patch61: 0002-Revert-drisw-Copy-entire-buffer-ignoring-damage-regi.patch
# Fix HOME directory being part of NFS
# https://issues.redhat.com/browse/RHEL-110665
Patch70: 0001-util-disk_cache-Re-enable-multi-file-cache-by-defaul.patch
# Build our own version but keep the dependency for the RPM macros
BuildRequires: meson
BuildRequires: gcc
@ -856,10 +860,13 @@ popd
%endif
%changelog
* Tue Feb 17 2026 Koichiro Iwao <meta@almalinux.org> - 25.0.7-4.alma.1
* Thu Mar 12 2026 Koichiro Iwao <meta@almalinux.org> - 25.0.7-5.alma.1
- Enable vc4 and v3d for Raspberry Pi graphics in AlmaLinux (Resolves:
https://github.com/AlmaLinux/raspberry-pi/issues/32)
* Mon Feb 23 2026 Anusha Srivatsa <asrivats@redhat.com> - 25.0.7-5
- Resolves: https://issues.redhat.com/browse/RHEL-151404
* Tue Jan 6 2026 Jocelyn Falempe <jfalempe@redhat.com - 25.0.7-4
- Resolves: https://issues.redhat.com/browse/RHEL-138704