summaryrefslogtreecommitdiff
path: root/opengl
diff options
context:
space:
mode:
authorPeiyong Lin <lpy@google.com>2023-06-28 23:53:19 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-28 23:53:19 +0000
commit02afd9df1f2940bcca008794019ffedf3ccc16a8 (patch)
treeca85c3f148898bbb4f0090c08eedb4a3ce113d75 /opengl
parentd306969b71301de298221e13137dc91f345d8171 (diff)
parentde8bd96be0ed1f14e944920f48482a541019526d (diff)
downloadnative-02afd9df1f2940bcca008794019ffedf3ccc16a8.tar.gz
Merge "Avoid unloading ANGLE." into udc-qpr-dev am: de8bd96be0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/23845380 Change-Id: I529d6f844e99d66442eb5704a9738f31e81e4979 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/Loader.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index b4fc5f0dd2..8d0eb590bf 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -161,7 +161,12 @@ static bool should_unload_system_driver(egl_connection_t* cnx) {
// Return true if ANGLE namespace is set.
android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
if (ns) {
- return true;
+ // Unless the default GLES driver is ANGLE and the process should use system ANGLE, since
+ // the intended GLES driver is already loaded.
+ // This should be updated in a later patch that cleans up namespaces
+ if (!(cnx->angleLoaded && android::GraphicsEnv::getInstance().shouldUseSystemAngle())) {
+ return true;
+ }
}
// Return true if updated driver namespace is set.
@@ -206,17 +211,17 @@ void Loader::unload_system_driver(egl_connection_t* cnx) {
do_android_unload_sphal_library(hnd->dso[0]);
}
cnx->dso = nullptr;
+ cnx->angleLoaded = false;
}
cnx->systemDriverUnloaded = true;
}
-void* Loader::open(egl_connection_t* cnx)
-{
+void* Loader::open(egl_connection_t* cnx) {
ATRACE_CALL();
const nsecs_t openTime = systemTime();
- if (should_unload_system_driver(cnx)) {
+ if (cnx->dso && should_unload_system_driver(cnx)) {
unload_system_driver(cnx);
}
@@ -225,8 +230,12 @@ void* Loader::open(egl_connection_t* cnx)
return cnx->dso;
}
- // Firstly, try to load ANGLE driver.
- driver_t* hnd = attempt_to_load_angle(cnx);
+ driver_t* hnd = nullptr;
+ // Firstly, try to load ANGLE driver, if ANGLE should be loaded and fail, abort.
+ if (android::GraphicsEnv::getInstance().shouldUseAngle()) {
+ hnd = attempt_to_load_angle(cnx);
+ LOG_ALWAYS_FATAL_IF(!hnd, "Failed to load ANGLE.");
+ }
if (!hnd) {
// Secondly, try to load from driver apk.
@@ -541,10 +550,6 @@ static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) {
ATRACE_CALL();
- if (!android::GraphicsEnv::getInstance().shouldUseAngle()) {
- return nullptr;
- }
-
android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
if (!ns) {
return nullptr;