Mesa (master): android: Disable trying to read/write to the disk cache.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 22 20:54:44 UTC 2020


Module: Mesa
Branch: master
Commit: ee4cee6dbdfcafb0ec88fe010d4ae05ce06e2e52
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee4cee6dbdfcafb0ec88fe010d4ae05ce06e2e52

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Sep 18 10:42:52 2020 -0700

android: Disable trying to read/write to the disk cache.

We need the disk cache enabled in Android to get EGL_ANDROID_blob_cache's
callbacks called, but we don't actually want to store anything on disk.
Fixes "Failed to create //.cache for shader cache (Read-only file
system)---disabling." spam on init.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6762>

---

 src/compiler/glsl/tests/cache_test.c | 7 +++++++
 src/util/disk_cache.c                | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/compiler/glsl/tests/cache_test.c b/src/compiler/glsl/tests/cache_test.c
index a1db67a5845..ab36aa49266 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -204,6 +204,13 @@ test_disk_cache_create(void)
 
    disk_cache_destroy(cache);
 
+#ifdef ANDROID
+   /* Android doesn't try writing to disk (just calls the cache callbacks), so
+    * the directory tests below don't apply.
+    */
+   exit(error ? 1 : 0);
+#endif
+
    /* Test with XDG_CACHE_HOME set */
    setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
    cache = disk_cache_create("test", "make_check", 0);
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 9953de62819..e1eee29839f 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -95,6 +95,14 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
    /* Assume failure. */
    cache->path_init_failed = true;
 
+#ifdef ANDROID
+   /* Android needs the "disk cache" to be enabled for
+    * EGL_ANDROID_blob_cache's callbacks to be called, but it doesn't actually
+    * want any storing to disk to happen inside of the driver.
+    */
+   goto path_fail;
+#endif
+
    char *path = disk_cache_generate_cache_dir(local);
    if (!path)
       goto path_fail;



More information about the mesa-commit mailing list