Loading libs/graphicsenv/GraphicsEnv.cpp +30 −4 Original line number Diff line number Diff line Loading @@ -56,16 +56,27 @@ void GraphicsEnv::setDriverPath(const std::string path) { mDriverPath = path; } void GraphicsEnv::setAnglePath(const std::string path) { void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, bool developerOptIn) { if (!mAnglePath.empty()) { ALOGV("ignoring attempt to change ANGLE path from '%s' to '%s'", mAnglePath.c_str(), path.c_str()); return; } } else { ALOGV("setting ANGLE path to '%s'", path.c_str()); mAnglePath = path; } if (!mAngleAppName.empty()) { ALOGV("ignoring attempt to change ANGLE app name from '%s' to '%s'", mAngleAppName.c_str(), appName.c_str()); } else { ALOGV("setting ANGLE app name to '%s'", appName.c_str()); mAngleAppName = appName; } mAngleDeveloperOptIn = developerOptIn; } void GraphicsEnv::setLayerPaths(NativeLoaderNamespace* appNamespace, const std::string layerPaths) { if (mLayerPaths.empty()) { mLayerPaths = layerPaths; Loading @@ -80,6 +91,15 @@ NativeLoaderNamespace* GraphicsEnv::getAppNamespace() { return mAppNamespace; } const char* GraphicsEnv::getAngleAppName() { if (mAngleAppName.empty()) return nullptr; return mAngleAppName.c_str(); } bool GraphicsEnv::getAngleDeveloperOptIn() { return mAngleDeveloperOptIn; } const std::string GraphicsEnv::getLayerPaths(){ return mLayerPaths; } Loading Loading @@ -139,4 +159,10 @@ android_namespace_t* android_getDriverNamespace() { android_namespace_t* android_getAngleNamespace() { return android::GraphicsEnv::getInstance().getAngleNamespace(); } const char* android_getAngleAppName() { return android::GraphicsEnv::getInstance().getAngleAppName(); } bool android_getAngleDeveloperOptIn() { return android::GraphicsEnv::getInstance().getAngleDeveloperOptIn(); } } libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +11 −3 Original line number Diff line number Diff line Loading @@ -42,8 +42,10 @@ public: // (libraries must be stored uncompressed and page aligned); such elements // in the search path must have a '!' after the zip filename, e.g. // /system/app/ANGLEPrebuilt/ANGLEPrebuilt.apk!/lib/arm64-v8a void setAnglePath(const std::string path); void setAngleInfo(const std::string path, const std::string appName, const bool optIn); android_namespace_t* getAngleNamespace(); const char* getAngleAppName(); bool getAngleDeveloperOptIn(); void setLayerPaths(NativeLoaderNamespace* appNamespace, const std::string layerPaths); NativeLoaderNamespace* getAppNamespace(); Loading @@ -57,6 +59,8 @@ private: GraphicsEnv() = default; std::string mDriverPath; std::string mAnglePath; std::string mAngleAppName; bool mAngleDeveloperOptIn; std::string mDebugLayers; std::string mLayerPaths; android_namespace_t* mDriverNamespace = nullptr; Loading @@ -77,7 +81,11 @@ private: * - the EGLsyncKHR synchronization in BufferQueue, which is deprecated and * will be removed soon. */ extern "C" android_namespace_t* android_getDriverNamespace(); extern "C" android_namespace_t* android_getAngleNamespace(); extern "C" { android_namespace_t* android_getDriverNamespace(); android_namespace_t* android_getAngleNamespace(); const char* android_getAngleAppName(); bool android_getAngleDeveloperOptIn(); } #endif // ANDROID_UI_GRAPHICS_ENV_H opengl/libs/EGL/Loader.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ static void* load_angle_from_namespace(const char* kind, android_namespace_t* ns return nullptr; } static void* load_angle(const char* kind, android_namespace_t* ns, egl_connection_t* cnx) { static void* load_angle(const char* kind, egl_connection_t* cnx) { // Only attempt to load ANGLE libs if (strcmp(kind, "EGL") != 0 && strcmp(kind, "GLESv2") != 0 && strcmp(kind, "GLESv1_CM") != 0) return nullptr; Loading @@ -483,11 +483,20 @@ static void* load_angle(const char* kind, android_namespace_t* ns, egl_connectio void* so = nullptr; std::string name; android_namespace_t* ns = android_getAngleNamespace(); const char* app_name = android_getAngleAppName(); bool developer_opt_in = android_getAngleDeveloperOptIn(); if (ns) { // If we got a namespce for ANGLE, check any other conditions // before loading from it. if (developer_opt_in) { so = load_angle_from_namespace(kind, ns); } } if (so) { ALOGD("Loaded ANGLE libraries for %s", app_name ? app_name : "nullptr"); cnx->useAngle = true; // Find and load vendor libEGL for ANGLE if (!cnx->vendorEGL) { Loading Loading @@ -530,11 +539,10 @@ void *Loader::load_driver(const char* kind, ATRACE_CALL(); void* dso = nullptr; android_namespace_t* ns = android_getAngleNamespace(); dso = load_angle(kind, ns, cnx); dso = load_angle(kind, cnx); #ifndef __ANDROID_VNDK__ if (!dso) { ns = android_getDriverNamespace(); android_namespace_t* ns = android_getDriverNamespace(); if (ns) { dso = load_updated_driver(kind, ns); } Loading Loading
libs/graphicsenv/GraphicsEnv.cpp +30 −4 Original line number Diff line number Diff line Loading @@ -56,16 +56,27 @@ void GraphicsEnv::setDriverPath(const std::string path) { mDriverPath = path; } void GraphicsEnv::setAnglePath(const std::string path) { void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, bool developerOptIn) { if (!mAnglePath.empty()) { ALOGV("ignoring attempt to change ANGLE path from '%s' to '%s'", mAnglePath.c_str(), path.c_str()); return; } } else { ALOGV("setting ANGLE path to '%s'", path.c_str()); mAnglePath = path; } if (!mAngleAppName.empty()) { ALOGV("ignoring attempt to change ANGLE app name from '%s' to '%s'", mAngleAppName.c_str(), appName.c_str()); } else { ALOGV("setting ANGLE app name to '%s'", appName.c_str()); mAngleAppName = appName; } mAngleDeveloperOptIn = developerOptIn; } void GraphicsEnv::setLayerPaths(NativeLoaderNamespace* appNamespace, const std::string layerPaths) { if (mLayerPaths.empty()) { mLayerPaths = layerPaths; Loading @@ -80,6 +91,15 @@ NativeLoaderNamespace* GraphicsEnv::getAppNamespace() { return mAppNamespace; } const char* GraphicsEnv::getAngleAppName() { if (mAngleAppName.empty()) return nullptr; return mAngleAppName.c_str(); } bool GraphicsEnv::getAngleDeveloperOptIn() { return mAngleDeveloperOptIn; } const std::string GraphicsEnv::getLayerPaths(){ return mLayerPaths; } Loading Loading @@ -139,4 +159,10 @@ android_namespace_t* android_getDriverNamespace() { android_namespace_t* android_getAngleNamespace() { return android::GraphicsEnv::getInstance().getAngleNamespace(); } const char* android_getAngleAppName() { return android::GraphicsEnv::getInstance().getAngleAppName(); } bool android_getAngleDeveloperOptIn() { return android::GraphicsEnv::getInstance().getAngleDeveloperOptIn(); } }
libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +11 −3 Original line number Diff line number Diff line Loading @@ -42,8 +42,10 @@ public: // (libraries must be stored uncompressed and page aligned); such elements // in the search path must have a '!' after the zip filename, e.g. // /system/app/ANGLEPrebuilt/ANGLEPrebuilt.apk!/lib/arm64-v8a void setAnglePath(const std::string path); void setAngleInfo(const std::string path, const std::string appName, const bool optIn); android_namespace_t* getAngleNamespace(); const char* getAngleAppName(); bool getAngleDeveloperOptIn(); void setLayerPaths(NativeLoaderNamespace* appNamespace, const std::string layerPaths); NativeLoaderNamespace* getAppNamespace(); Loading @@ -57,6 +59,8 @@ private: GraphicsEnv() = default; std::string mDriverPath; std::string mAnglePath; std::string mAngleAppName; bool mAngleDeveloperOptIn; std::string mDebugLayers; std::string mLayerPaths; android_namespace_t* mDriverNamespace = nullptr; Loading @@ -77,7 +81,11 @@ private: * - the EGLsyncKHR synchronization in BufferQueue, which is deprecated and * will be removed soon. */ extern "C" android_namespace_t* android_getDriverNamespace(); extern "C" android_namespace_t* android_getAngleNamespace(); extern "C" { android_namespace_t* android_getDriverNamespace(); android_namespace_t* android_getAngleNamespace(); const char* android_getAngleAppName(); bool android_getAngleDeveloperOptIn(); } #endif // ANDROID_UI_GRAPHICS_ENV_H
opengl/libs/EGL/Loader.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ static void* load_angle_from_namespace(const char* kind, android_namespace_t* ns return nullptr; } static void* load_angle(const char* kind, android_namespace_t* ns, egl_connection_t* cnx) { static void* load_angle(const char* kind, egl_connection_t* cnx) { // Only attempt to load ANGLE libs if (strcmp(kind, "EGL") != 0 && strcmp(kind, "GLESv2") != 0 && strcmp(kind, "GLESv1_CM") != 0) return nullptr; Loading @@ -483,11 +483,20 @@ static void* load_angle(const char* kind, android_namespace_t* ns, egl_connectio void* so = nullptr; std::string name; android_namespace_t* ns = android_getAngleNamespace(); const char* app_name = android_getAngleAppName(); bool developer_opt_in = android_getAngleDeveloperOptIn(); if (ns) { // If we got a namespce for ANGLE, check any other conditions // before loading from it. if (developer_opt_in) { so = load_angle_from_namespace(kind, ns); } } if (so) { ALOGD("Loaded ANGLE libraries for %s", app_name ? app_name : "nullptr"); cnx->useAngle = true; // Find and load vendor libEGL for ANGLE if (!cnx->vendorEGL) { Loading Loading @@ -530,11 +539,10 @@ void *Loader::load_driver(const char* kind, ATRACE_CALL(); void* dso = nullptr; android_namespace_t* ns = android_getAngleNamespace(); dso = load_angle(kind, ns, cnx); dso = load_angle(kind, cnx); #ifndef __ANDROID_VNDK__ if (!dso) { ns = android_getDriverNamespace(); android_namespace_t* ns = android_getDriverNamespace(); if (ns) { dso = load_updated_driver(kind, ns); } Loading