summaryrefslogtreecommitdiff
path: root/libs/graphicsenv/GraphicsEnv.cpp
diff options
context:
space:
mode:
author Cody Northrop <cnorthrop@google.com> 2022-12-12 11:35:54 -0700
committer Cody Northrop <cnorthrop@google.com> 2022-12-21 18:55:24 -0700
commitc45249975aa7d6e8894e991c7acb1765f076db56 (patch)
tree9805f05b254a42d90f606195fe92ec6b6bcdc3df /libs/graphicsenv/GraphicsEnv.cpp
parent34dfbf0c36c74e732b2cb2402f7a55747e56ddeb (diff)
EGL BlobCache: Support multifile cache and flexible size limit
This CL introduces the ability to support EGL blob cache using multiple files. This allows us to increase the amount of cache available to applications, without increasing process memory used to get/set from the cache. In order to support this, entries will be written to a new directory in the same location: $ adb shell # cd /data/user_de/0/<packge_name>/code_cache # ls -la com.android.opengl.shaders_cache.multifile total 53M drwx--S--- 2 u0_a276 u0_a276_cache 248K 2022-12-13 15:45 . drwxrws--x 3 u0_a276 u0_a276_cache 404K 2022-12-13 11:26 .. -rw------- 1 u0_a276 u0_a276_cache 7.1K 2022-12-13 15:43 1000572839 -rw------- 1 u0_a276 u0_a276_cache 8.9K 2022-12-13 15:43 1000616115 -rw------- 1 u0_a276 u0_a276_cache 5.0K 2022-12-13 15:43 1001816402 -rw------- 1 u0_a276 u0_a276_cache 4.3K 2022-12-13 15:44 1002265221 -rw------- 1 u0_a276 u0_a276_cache 8.2K 2022-12-13 15:44 1002773033 -rw------- 1 u0_a276 u0_a276_cache 2.8K 2022-12-13 15:45 1004532460 -rw------- 1 u0_a276 u0_a276_cache 4.3K 2022-12-13 15:45 1005120329 ... The filenames are generated by hashing the incoming key. The cache limit is set in ag/20506291 by GraphicsEnvironment based on getCacheQuotaBytes from StorageManager. If exceeded, we invoke an LRU that clears files, oldest first, until under the cap. The new mode is enable by default, but can be disabled with: adb shell setprop debug.egl.blobcache.multifilemode false The cache limit can also be modified with debug properties: adb shell setprop debug.egl.blobcache.bytelimit <bytes> Test: Multiple apps and ANGLE traces Test: /data/nativetest64/EGL_test/EGL_test Bug: b/246966894 Change-Id: I5e946d43728fdcea7dad08a4283129490893a122
Diffstat (limited to 'libs/graphicsenv/GraphicsEnv.cpp')
-rw-r--r--libs/graphicsenv/GraphicsEnv.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 46dd62d3bf..c6d9052d1b 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -569,6 +569,14 @@ void GraphicsEnv::setDebugLayersGLES(const std::string layers) {
mDebugLayersGLES = layers;
}
+int64_t GraphicsEnv::getBlobCacheQuotaBytes() {
+ return mBlobCacheQuotaBytes;
+}
+
+void GraphicsEnv::setBlobCacheQuotaBytes(int64_t cacheBytes) {
+ mBlobCacheQuotaBytes = cacheBytes;
+}
+
// Return true if all the required libraries from vndk and sphal namespace are
// linked to the updatable gfx driver namespace correctly.
bool GraphicsEnv::linkDriverNamespaceLocked(android_namespace_t* vndkNamespace) {