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

Commit 21b0037d authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "Plumb ANGLE EGL features for debugging."

parents 89a1a44d 2f707e69
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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;
}
+6 −1
Original line number Diff line number Diff line
@@ -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.
+20 −0
Original line number Diff line number Diff line
@@ -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_
+10 −0
Original line number Diff line number Diff line
@@ -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);