Skip to content

Commit 15e275c

Browse files
committed
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
1 parent 93ef636 commit 15e275c

2 files changed

Lines changed: 44 additions & 8 deletions

File tree

opengl/libs/Android.bp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ package {
88
default_applicable_licenses: ["frameworks_native_license"],
99
}
1010

11+
cc_aconfig_library {
12+
name: "libegl_flags_c_lib",
13+
aconfig_declarations: "graphicsenv_flags",
14+
}
15+
1116
cc_library {
1217
name: "libETC1",
1318
srcs: ["ETC1/etc1.cpp"],
@@ -155,7 +160,10 @@ cc_library_static {
155160

156161
cc_library_shared {
157162
name: "libEGL",
158-
defaults: ["egl_libs_defaults"],
163+
defaults: [
164+
"aconfig_lib_cc_static_link.defaults",
165+
"egl_libs_defaults",
166+
],
159167
llndk: {
160168
symbol_file: "libEGL.map.txt",
161169
export_llndk_headers: ["gl_headers"],
@@ -191,6 +199,7 @@ cc_library_shared {
191199
static_libs: [
192200
"libEGL_getProcAddress",
193201
"libEGL_blobCache",
202+
"libegl_flags_c_lib",
194203
],
195204
ldflags: [
196205
"-Wl,--exclude-libs=libEGL_getProcAddress.a",

opengl/libs/EGL/egl_display.cpp

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <android-base/properties.h>
2323
#include <android/dlext.h>
2424
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
25+
#include <com_android_graphics_graphicsenv_flags.h>
2526
#include <configstore/Utils.h>
2627
#include <dlfcn.h>
2728
#include <graphicsenv/GraphicsEnv.h>
@@ -37,6 +38,7 @@
3738

3839
using namespace android::hardware::configstore;
3940
using namespace android::hardware::configstore::V1_0;
41+
namespace graphicsenv_flags = com::android::graphics::graphicsenv::flags;
4042

4143
namespace android {
4244

@@ -138,15 +140,40 @@ static EGLDisplay getPlatformDisplayAngle(EGLNativeDisplayType display, egl_conn
138140
attrs.push_back(attr[1]);
139141
}
140142
}
141-
const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures();
142-
std::vector<const char*> features;
143-
if (eglFeatures.size() > 0) {
143+
144+
if (graphicsenv_flags::feature_overrides()) {
145+
std::vector<const char*> enabled; // ANGLE features to enable
146+
std::vector<const char*> disabled; // ANGLE features to disable
147+
148+
// Get the list of ANGLE features to enable from Global.Settings.
149+
const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures();
144150
for (const std::string& eglFeature : eglFeatures) {
145-
features.push_back(eglFeature.c_str());
151+
enabled.push_back(eglFeature.c_str());
152+
}
153+
154+
// Get the list of ANGLE features to enable/disable from gpuservice.
155+
GraphicsEnv::getInstance().getAngleFeatureOverrides(enabled, disabled);
156+
if (!enabled.empty()) {
157+
enabled.push_back(0);
158+
attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE);
159+
attrs.push_back(reinterpret_cast<EGLAttrib>(enabled.data()));
160+
}
161+
if (!disabled.empty()) {
162+
disabled.push_back(0);
163+
attrs.push_back(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE);
164+
attrs.push_back(reinterpret_cast<EGLAttrib>(disabled.data()));
165+
}
166+
} else {
167+
const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures();
168+
std::vector<const char*> features;
169+
if (eglFeatures.size() > 0) {
170+
for (const std::string& eglFeature : eglFeatures) {
171+
features.push_back(eglFeature.c_str());
172+
}
173+
features.push_back(0);
174+
attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE);
175+
attrs.push_back(reinterpret_cast<EGLAttrib>(features.data()));
146176
}
147-
features.push_back(0);
148-
attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE);
149-
attrs.push_back(reinterpret_cast<EGLAttrib>(features.data()));
150177
}
151178

152179
attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);

0 commit comments

Comments
 (0)