diff options
author | 2024-11-19 22:41:23 -0700 | |
---|---|---|
committer | 2024-11-27 22:50:47 -0700 | |
commit | 4ee63869b1be41e002733a520ade5ba48abc8c8c (patch) | |
tree | 1fafa267fdbbed000ab19585a64f6c854c240c67 /opengl | |
parent | d71f586652092a91aa93c365ecece7d82f93218f (diff) |
EGL: Add flag for bugfixes found via advanced blobcache usage
Test: libEGL_test, EGL_test
Bug: b/351867582, b/380483358
Flag: com.android.graphics.egl.flags.multifile_blobcache_advanced_usage
Change-Id: I08c8b2e1e255caead4333b69e0a94148a3b4f0b1
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libs/Android.bp | 15 | ||||
-rw-r--r-- | opengl/libs/EGL/MultifileBlobCache.cpp | 11 | ||||
-rw-r--r-- | opengl/libs/EGL/MultifileBlobCache.h | 4 | ||||
-rw-r--r-- | opengl/libs/EGL/MultifileBlobCache_test.cpp | 8 | ||||
-rw-r--r-- | opengl/libs/EGL/egl_flags.aconfig | 13 | ||||
-rw-r--r-- | opengl/libs/EGL/fuzzer/Android.bp | 1 | ||||
-rw-r--r-- | opengl/tests/EGLTest/Android.bp | 1 |
7 files changed, 51 insertions, 2 deletions
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp index b19a862b6c..91250b9945 100644 --- a/opengl/libs/Android.bp +++ b/opengl/libs/Android.bp @@ -63,6 +63,18 @@ ndk_library { unversioned_until: "current", } +aconfig_declarations { + name: "egl_flags", + package: "com.android.graphics.egl.flags", + container: "system", + srcs: ["EGL/egl_flags.aconfig"], +} + +cc_aconfig_library { + name: "libegl_flags", + aconfig_declarations: "egl_flags", +} + cc_defaults { name: "gl_libs_defaults", cflags: [ @@ -136,6 +148,7 @@ cc_library_static { ], export_include_dirs: ["EGL"], shared_libs: [ + "libegl_flags", "libz", ], } @@ -166,6 +179,7 @@ cc_library_shared { "android.hardware.configstore@1.0", "android.hardware.configstore-utils", "libbase", + "libegl_flags", "libhidlbase", "libnativebridge_lazy", "libnativeloader_lazy", @@ -202,6 +216,7 @@ cc_test { "EGL/MultifileBlobCache_test.cpp", ], shared_libs: [ + "libegl_flags", "libutils", "libz", ], diff --git a/opengl/libs/EGL/MultifileBlobCache.cpp b/opengl/libs/EGL/MultifileBlobCache.cpp index f7e33b383f..ebbb8c407d 100644 --- a/opengl/libs/EGL/MultifileBlobCache.cpp +++ b/opengl/libs/EGL/MultifileBlobCache.cpp @@ -38,6 +38,10 @@ #include <utils/JenkinsHash.h> +#include <com_android_graphics_egl_flags.h> + +using namespace com::android::graphics::egl; + using namespace std::literals; constexpr uint32_t kMultifileMagic = 'MFB$'; @@ -80,8 +84,13 @@ MultifileBlobCache::MultifileBlobCache(size_t maxKeySize, size_t maxValueSize, s return; } - // Set the cache version, override if debug value set + // Set the cache version mCacheVersion = kMultifileBlobCacheVersion; + // Bump the version if we're using flagged features + if (flags::multifile_blobcache_advanced_usage()) { + mCacheVersion++; + } + // Override if debug value set int debugCacheVersion = base::GetIntProperty("debug.egl.blobcache.cache_version", -1); if (debugCacheVersion >= 0) { ALOGV("INIT: Using %u as cacheVersion instead of %u", debugCacheVersion, mCacheVersion); diff --git a/opengl/libs/EGL/MultifileBlobCache.h b/opengl/libs/EGL/MultifileBlobCache.h index 65aa2db344..fe477bc76a 100644 --- a/opengl/libs/EGL/MultifileBlobCache.h +++ b/opengl/libs/EGL/MultifileBlobCache.h @@ -32,6 +32,10 @@ #include "FileBlobCache.h" +#include <com_android_graphics_egl_flags.h> + +using namespace com::android::graphics::egl; + namespace android { constexpr uint32_t kMultifileBlobCacheVersion = 2; diff --git a/opengl/libs/EGL/MultifileBlobCache_test.cpp b/opengl/libs/EGL/MultifileBlobCache_test.cpp index 90a0f1ee06..8222498e0b 100644 --- a/opengl/libs/EGL/MultifileBlobCache_test.cpp +++ b/opengl/libs/EGL/MultifileBlobCache_test.cpp @@ -25,6 +25,10 @@ #include <fstream> #include <memory> +#include <com_android_graphics_egl_flags.h> + +using namespace com::android::graphics::egl; + using namespace std::literals; namespace android { @@ -458,6 +462,8 @@ TEST_F(MultifileBlobCacheTest, MismatchedCacheVersionClears) { // Set one entry mMBC->set("abcd", 4, "efgh", 4); + uint32_t initialCacheVersion = mMBC->getCurrentCacheVersion(); + // Close the cache so everything writes out mMBC->finish(); mMBC.reset(); @@ -466,7 +472,7 @@ TEST_F(MultifileBlobCacheTest, MismatchedCacheVersionClears) { ASSERT_EQ(getCacheEntries().size(), 1); // Set a debug cacheVersion - std::string newCacheVersion = std::to_string(kMultifileBlobCacheVersion + 1); + std::string newCacheVersion = std::to_string(initialCacheVersion + 1); ASSERT_TRUE(base::SetProperty("debug.egl.blobcache.cache_version", newCacheVersion.c_str())); ASSERT_TRUE( base::WaitForProperty("debug.egl.blobcache.cache_version", newCacheVersion.c_str())); diff --git a/opengl/libs/EGL/egl_flags.aconfig b/opengl/libs/EGL/egl_flags.aconfig new file mode 100644 index 0000000000..115797071c --- /dev/null +++ b/opengl/libs/EGL/egl_flags.aconfig @@ -0,0 +1,13 @@ +package: "com.android.graphics.egl.flags" +container: "system" + +flag { + name: "multifile_blobcache_advanced_usage" + namespace: "gpu" + description: "This flag controls new behaviors to address bugs found via advanced usage" + bug: "380483358" + is_fixed_read_only: true + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/opengl/libs/EGL/fuzzer/Android.bp b/opengl/libs/EGL/fuzzer/Android.bp index 4947e5ff6c..fe5f2a6de6 100644 --- a/opengl/libs/EGL/fuzzer/Android.bp +++ b/opengl/libs/EGL/fuzzer/Android.bp @@ -37,6 +37,7 @@ cc_fuzz { ], shared_libs: [ + "libegl_flags", "libz", ], diff --git a/opengl/tests/EGLTest/Android.bp b/opengl/tests/EGLTest/Android.bp index aebd3f2bf2..ed46efd81e 100644 --- a/opengl/tests/EGLTest/Android.bp +++ b/opengl/tests/EGLTest/Android.bp @@ -26,6 +26,7 @@ cc_test { "android.hardware.configstore@1.0", "android.hardware.configstore-utils", "libEGL", + "libegl_flags", "libbase", "libcutils", "libbinder", |