diff options
author | 2020-09-26 13:52:10 -0700 | |
---|---|---|
committer | 2020-09-26 13:56:09 -0700 | |
commit | 2f707e699b4f080e9360dbf79edc039c8a4f6d4f (patch) | |
tree | 418cce5d61269ce11ce824bb464b4fe61e4cf711 | |
parent | 487496c44f1d5f987c8ecf930c787947e0366f20 (diff) |
Plumb ANGLE EGL features for debugging.
Bug: b/169156341
Test: use adb shell command to verify
Change-Id: Id488508d4858c4604108952fef512fa5086a2aa6
-rw-r--r-- | libs/graphicsenv/GraphicsEnv.cpp | 9 | ||||
-rw-r--r-- | libs/graphicsenv/include/graphicsenv/GraphicsEnv.h | 7 | ||||
-rw-r--r-- | opengl/include/EGL/eglext_angle.h | 20 | ||||
-rw-r--r-- | opengl/libs/EGL/egl_display.cpp | 10 |
4 files changed, 44 insertions, 2 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp index 119b3e0b7d..55c5de9477 100644 --- a/libs/graphicsenv/GraphicsEnv.cpp +++ b/libs/graphicsenv/GraphicsEnv.cpp @@ -466,7 +466,8 @@ void GraphicsEnv::updateUseAngle() { } void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, - const std::string developerOptIn, const int rulesFd, + const std::string developerOptIn, + const std::vector<std::string> eglFeatures, const int rulesFd, const long rulesOffset, const long rulesLength) { if (mUseAngle != UNKNOWN) { // We've already figured out an answer for this app, so just return. @@ -475,6 +476,8 @@ void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName return; } + mAngleEglFeatures = std::move(eglFeatures); + ALOGV("setting ANGLE path to '%s'", path.c_str()); mAnglePath = path; ALOGV("setting ANGLE app name to '%s'", appName.c_str()); @@ -520,6 +523,10 @@ std::string& GraphicsEnv::getAngleAppName() { return mAngleAppName; } +const std::vector<std::string>& GraphicsEnv::getAngleEglFeatures() { + return mAngleEglFeatures; +} + const std::string& GraphicsEnv::getLayerPaths() { return mLayerPaths; } diff --git a/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h b/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h index 22a2332589..900fc49b59 100644 --- a/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +++ b/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h @@ -97,12 +97,15 @@ public: // in the search path must have a '!' after the zip filename, e.g. // /system/app/ANGLEPrebuilt/ANGLEPrebuilt.apk!/lib/arm64-v8a void setAngleInfo(const std::string path, const std::string appName, std::string devOptIn, - const int rulesFd, const long rulesOffset, const long rulesLength); + const std::vector<std::string> eglFeatures, const int rulesFd, + const long rulesOffset, const long rulesLength); // Get the ANGLE driver namespace. android_namespace_t* getAngleNamespace(); // Get the app name for ANGLE debug message. std::string& getAngleAppName(); + const std::vector<std::string>& getAngleEglFeatures(); + /* * Apis for debug layer */ @@ -154,6 +157,8 @@ private: std::string mAngleAppName; // ANGLE developer opt in status. std::string mAngleDeveloperOptIn; + // ANGLE EGL features; + std::vector<std::string> mAngleEglFeatures; // ANGLE rules. std::vector<char> mRulesBuffer; // Use ANGLE flag. diff --git a/opengl/include/EGL/eglext_angle.h b/opengl/include/EGL/eglext_angle.h index 1f1bcb3950..e753e0d60f 100644 --- a/opengl/include/EGL/eglext_angle.h +++ b/opengl/include/EGL/eglext_angle.h @@ -186,6 +186,26 @@ EGLAPI EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limi #define EGL_EXTENSIONS_ENABLED_ANGLE 0x345F #endif /* EGL_ANGLE_create_context_extensions_enabled */ +#ifndef EGL_ANGLE_feature_control +#define EGL_ANGLE_feature_control 1 +#define EGL_FEATURE_NAME_ANGLE 0x3460 +#define EGL_FEATURE_CATEGORY_ANGLE 0x3461 +#define EGL_FEATURE_DESCRIPTION_ANGLE 0x3462 +#define EGL_FEATURE_BUG_ANGLE 0x3463 +#define EGL_FEATURE_STATUS_ANGLE 0x3464 +#define EGL_FEATURE_COUNT_ANGLE 0x3465 +#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466 +#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467 +#define EGL_FEATURE_CONDITION_ANGLE 0x3468 +#define EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469 +typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribANGLE(EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#endif +#endif /* EGL_ANGLE_feature_control */ + // clang-format on #endif // INCLUDE_EGL_EGLEXT_ANGLE_ diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp index a288c21f31..0b755aadca 100644 --- a/opengl/libs/EGL/egl_display.cpp +++ b/opengl/libs/EGL/egl_display.cpp @@ -143,6 +143,16 @@ 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) { + 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())); + } attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE); |