Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ee63869 authored by Cody Northrop's avatar Cody Northrop
Browse files

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
parent d71f5866
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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",
    ],
+10 −1
Original line number Diff line number Diff line
@@ -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);
+4 −0
Original line number Diff line number Diff line
@@ -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;
+7 −1
Original line number Diff line number Diff line
@@ -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()));
+13 −0
Original line number Diff line number Diff line
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
  }
}
Loading