|
22 | 22 | #include <android-base/properties.h> |
23 | 23 | #include <android/dlext.h> |
24 | 24 | #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> |
| 25 | +#include <com_android_graphics_graphicsenv_flags.h> |
25 | 26 | #include <configstore/Utils.h> |
26 | 27 | #include <dlfcn.h> |
27 | 28 | #include <graphicsenv/GraphicsEnv.h> |
|
37 | 38 |
|
38 | 39 | using namespace android::hardware::configstore; |
39 | 40 | using namespace android::hardware::configstore::V1_0; |
| 41 | +namespace graphicsenv_flags = com::android::graphics::graphicsenv::flags; |
40 | 42 |
|
41 | 43 | namespace android { |
42 | 44 |
|
@@ -138,15 +140,40 @@ static EGLDisplay getPlatformDisplayAngle(EGLNativeDisplayType display, egl_conn |
138 | 140 | attrs.push_back(attr[1]); |
139 | 141 | } |
140 | 142 | } |
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(); |
144 | 150 | 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())); |
146 | 176 | } |
147 | | - features.push_back(0); |
148 | | - attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE); |
149 | | - attrs.push_back(reinterpret_cast<EGLAttrib>(features.data())); |
150 | 177 | } |
151 | 178 |
|
152 | 179 | attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); |
|
0 commit comments