Clean up featuresutils library
dlclose the featureutils library when closing the driver.
Had tried closing inside load_angle but that won't work
due to threading and we will have a featureutil resource
we want to keep around.
Bug: 118613436
Bug: 118375731
Test: monkey UI testing
Test: cts-tradefed run singleCommand cts -m CtsAngleIntegrationHostTestCases
Change-Id: I40b13c679665951935f0e7254f24c384645365f3
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 922be02..3d1eb14 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -275,10 +275,24 @@
return (void*)hnd;
}
-void Loader::close(void* driver)
+void Loader::close(egl_connection_t* cnx)
{
- driver_t* hnd = (driver_t*)driver;
+ driver_t* hnd = (driver_t*) cnx->dso;
delete hnd;
+ cnx->dso = nullptr;
+
+ if (cnx->featureSo) {
+ dlclose(cnx->featureSo);
+ cnx->featureSo = nullptr;
+ }
+
+ cnx->angleDecided = false;
+ cnx->useAngle = false;
+
+ if (cnx->vendorEGL) {
+ dlclose(cnx->vendorEGL);
+ cnx->vendorEGL = nullptr;
+ }
}
void Loader::init_api(void* dso,
@@ -553,15 +567,9 @@
property_get("ro.product.manufacturer", manufacturer, "UNSET");
property_get("ro.product.model", model, "UNSET");
- // Check if ANGLE is enabled. Workaround for b/118375731
- // We suspect that loading & unloading a library somehow corrupts
- // the process.
- property_get("debug.angle.enable", prop, "0");
- if (atoi(prop)) {
- so = load_angle_from_namespace("feature_support", ns);
- }
- if (so) {
- ALOGV("Temporarily loaded ANGLE's opt-in/out logic from namespace");
+ cnx->featureSo = load_angle_from_namespace("feature_support", ns);
+ if (cnx->featureSo) {
+ ALOGV("loaded ANGLE's opt-in/out logic from namespace");
bool use_version0_API = false;
bool use_version1_API = false;
fpANGLEGetUtilityAPI ANGLEGetUtilityAPI =
@@ -605,14 +613,11 @@
ALOGW("Cannot find ANGLEUseForApplication in library");
}
}
- ALOGV("Close temporarily-loaded ANGLE opt-in/out logic");
- dlclose(so);
- so = nullptr;
} else {
// We weren't able to load and call the updateable opt-in/out logic.
// If we can't load the library, there is no ANGLE available.
use_angle = false;
- ALOGV("Could not temporarily-load the ANGLE opt-in/out logic, cannot use ANGLE.");
+ ALOGV("Could not load the ANGLE opt-in/out logic, cannot use ANGLE.");
}
cnx->angleDecided = true;
}