diff options
author | 2025-01-13 14:23:15 -0700 | |
---|---|---|
committer | 2025-01-15 17:28:33 -0700 | |
commit | 15e275c5f38662db880275c52f4e8e68f9208e9c (patch) | |
tree | 865a5d48ca613b9eb5e4feea92757c7de0a9e888 /opengl | |
parent | 93ef636c528af9567f8acb58705177e5c38def50 (diff) |
getPlatformDisplayAngle: Get ANGLE feature overrides
Query GraphicsEnv for the ANGLE feature overrides to apply when creating
an ANGLE EGL display.
Bug: 372694741
Test: CQ, Manual verification
Flag: com.android.graphics.graphicsenv.flags.feature_overrides
Change-Id: Ia17922e4e2136bbc0045221ac47d8454bd3e1b2d
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libs/Android.bp | 11 | ||||
-rw-r--r-- | opengl/libs/EGL/egl_display.cpp | 41 |
2 files changed, 44 insertions, 8 deletions
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp index 91250b9945..eb747c767e 100644 --- a/opengl/libs/Android.bp +++ b/opengl/libs/Android.bp @@ -8,6 +8,11 @@ package { default_applicable_licenses: ["frameworks_native_license"], } +cc_aconfig_library { + name: "libegl_flags_c_lib", + aconfig_declarations: "graphicsenv_flags", +} + cc_library { name: "libETC1", srcs: ["ETC1/etc1.cpp"], @@ -155,7 +160,10 @@ cc_library_static { cc_library_shared { name: "libEGL", - defaults: ["egl_libs_defaults"], + defaults: [ + "aconfig_lib_cc_static_link.defaults", + "egl_libs_defaults", + ], llndk: { symbol_file: "libEGL.map.txt", export_llndk_headers: ["gl_headers"], @@ -191,6 +199,7 @@ cc_library_shared { static_libs: [ "libEGL_getProcAddress", "libEGL_blobCache", + "libegl_flags_c_lib", ], ldflags: [ "-Wl,--exclude-libs=libEGL_getProcAddress.a", diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp index b1a287fcec..5fe948478b 100644 --- a/opengl/libs/EGL/egl_display.cpp +++ b/opengl/libs/EGL/egl_display.cpp @@ -22,6 +22,7 @@ #include <android-base/properties.h> #include <android/dlext.h> #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> +#include <com_android_graphics_graphicsenv_flags.h> #include <configstore/Utils.h> #include <dlfcn.h> #include <graphicsenv/GraphicsEnv.h> @@ -37,6 +38,7 @@ using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; +namespace graphicsenv_flags = com::android::graphics::graphicsenv::flags; namespace android { @@ -138,15 +140,40 @@ static EGLDisplay getPlatformDisplayAngle(EGLNativeDisplayType display, egl_conn attrs.push_back(attr[1]); } } - const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures(); - std::vector<const char*> features; - if (eglFeatures.size() > 0) { + + if (graphicsenv_flags::feature_overrides()) { + std::vector<const char*> enabled; // ANGLE features to enable + std::vector<const char*> disabled; // ANGLE features to disable + + // Get the list of ANGLE features to enable from Global.Settings. + const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures(); for (const std::string& eglFeature : eglFeatures) { - features.push_back(eglFeature.c_str()); + enabled.push_back(eglFeature.c_str()); + } + + // Get the list of ANGLE features to enable/disable from gpuservice. + GraphicsEnv::getInstance().getAngleFeatureOverrides(enabled, disabled); + if (!enabled.empty()) { + enabled.push_back(0); + attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE); + attrs.push_back(reinterpret_cast<EGLAttrib>(enabled.data())); + } + if (!disabled.empty()) { + disabled.push_back(0); + attrs.push_back(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE); + attrs.push_back(reinterpret_cast<EGLAttrib>(disabled.data())); + } + } else { + const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures(); + std::vector<const char*> features; + if (eglFeatures.size() > 0) { + for (const std::string& eglFeature : eglFeatures) { + features.push_back(eglFeature.c_str()); + } + features.push_back(0); + attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE); + attrs.push_back(reinterpret_cast<EGLAttrib>(features.data())); } - features.push_back(0); - attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE); - attrs.push_back(reinterpret_cast<EGLAttrib>(features.data())); } attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); |