diff --git a/docs/envvars.rst b/docs/envvars.rst index 307eb5e28eb..23ddea6f94c 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -205,8 +205,8 @@ Core Mesa environment variables 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`` (if that - variable is set), or else within ``.cache/mesa_shader_cache`` within + 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_SHADER_CACHE_SHOW_STATS @@ -217,10 +217,9 @@ Core Mesa environment variables .. envvar:: MESA_DISK_CACHE_SINGLE_FILE if set to 1, enables the single file Fossilize DB on-disk shader - cache implementation instead of the default multi-file cache - implementation. This implementation reduces the overall disk usage by - the shader cache and also allows for loading of precompiled cache - DBs via :envvar:`MESA_DISK_CACHE_READ_ONLY_FOZ_DBS` or + cache implementation instead of the default Mesa-DB cache + implementation. This implementation allows for loading of precompiled + cache DBs via :envvar:`MESA_DISK_CACHE_READ_ONLY_FOZ_DBS` or :envvar:`MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST`. This implementation does not support cache size limits via :envvar:`MESA_SHADER_CACHE_MAX_SIZE`. If @@ -229,6 +228,16 @@ Core Mesa environment variables or else within ``.cache/mesa_shader_cache_sf`` within the user's home directory. +.. 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) + or else within ``.cache/mesa_shader_cache`` within the user's home + directory. + .. envvar:: MESA_DISK_CACHE_READ_ONLY_FOZ_DBS if set with :envvar:`MESA_DISK_CACHE_SINGLE_FILE` enabled, references @@ -240,18 +249,6 @@ 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 61825fa1360..ba8cbcd96f6 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -271,10 +271,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 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_DATABASE", false)) - cache_type = DISK_CACHE_DATABASE; - else + else if (debug_get_bool_option("MESA_DISK_CACHE_MULTI_FILE", false)) cache_type = DISK_CACHE_MULTI_FILE; + else + cache_type = DISK_CACHE_DATABASE; /* Create main writable cache. */ cache = disk_cache_type_create(gpu_name, driver_id, driver_flags, diff --git a/src/util/tests/cache_test.cpp b/src/util/tests/cache_test.cpp index 48d723b4742..af4edb71c1f 100644 --- a/src/util/tests/cache_test.cpp +++ b/src/util/tests/cache_test.cpp @@ -700,6 +700,8 @@ TEST_F(Cache, MultiFile) bool compress = true; run_tests: + setenv("MESA_DISK_CACHE_MULTI_FILE", "true", 1); + if (!compress) driver_id = "make_check_uncompressed"; else @@ -711,6 +713,8 @@ run_tests: test_put_key_and_get_key(driver_id); + setenv("MESA_DISK_CACHE_MULTI_FILE", "false", 1); + int err = rmrf_local(CACHE_TEST_TMP); EXPECT_EQ(err, 0) << "Removing " CACHE_TEST_TMP " again"; @@ -769,7 +773,6 @@ TEST_F(Cache, Database) GTEST_SKIP() << "ENABLE_SHADER_CACHE not defined."; #else 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); @@ -793,7 +796,6 @@ TEST_F(Cache, Database) test_put_and_get_between_instances_with_eviction(driver_id); - setenv("MESA_DISK_CACHE_DATABASE", "false", 1); unsetenv("MESA_DISK_CACHE_DATABASE_NUM_PARTS"); err = rmrf_local(CACHE_TEST_TMP); @@ -820,7 +822,7 @@ TEST_F(Cache, Combined) GTEST_SKIP() << "ENABLE_SHADER_CACHE not defined."; #else setenv("MESA_DISK_CACHE_SINGLE_FILE", "true", 1); - setenv("MESA_DISK_CACHE_DATABASE", "false", 1); + setenv("MESA_DISK_CACHE_MULTI_FILE", "true", 1); #ifdef SHADER_CACHE_DISABLE_BY_DEFAULT setenv("MESA_SHADER_CACHE_DISABLE", "false", 1); @@ -890,7 +892,7 @@ TEST_F(Cache, Combined) EXPECT_EQ(unlink(foz_rw_idx_file), 0); setenv("MESA_DISK_CACHE_SINGLE_FILE", "false", 1); - setenv("MESA_DISK_CACHE_DATABASE", "true", 1); + setenv("MESA_DISK_CACHE_MULTI_FILE", "false", 1); /* Create MESA-DB cache with enabled retrieval from the read-only * cache. */ @@ -959,7 +961,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. */ setenv("MESA_DISK_CACHE_COMBINE_RW_WITH_RO_FOZ", "true", 1); @@ -1017,6 +1019,8 @@ TEST_F(Cache, Combined) disk_cache_destroy(cache_multifile); + unsetenv("MESA_DISK_CACHE_MULTI_FILE"); + int err = rmrf_local(CACHE_TEST_TMP); EXPECT_EQ(err, 0) << "Removing " CACHE_TEST_TMP " again"; #endif @@ -1269,14 +1273,12 @@ TEST_F(Cache, DatabaseMultipartEviction) GTEST_SKIP() << "ENABLE_SHADER_CACHE not defined."; #else 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";