summaryrefslogtreecommitdiff
path: root/opengl
diff options
context:
space:
mode:
authorPeiyong Lin <lpy@google.com>2023-07-03 02:36:51 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-07-03 02:36:51 +0000
commitbc13c63cc077e2b81ad23dac2a391fc8d2d3922f (patch)
treeb7bf08db50e3a202c1d50c2fb66e32875badba16 /opengl
parenteb7d75b2425e2b0c93416bbc055cdecce9c306ed (diff)
parentb410845c8329b716757750c82a527062757ee200 (diff)
downloadnative-bc13c63cc077e2b81ad23dac2a391fc8d2d3922f.tar.gz
Merge "Load native GLES driver when specified." into udc-qpr-dev am: b410845c83
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/23865478 Change-Id: I364f614016947bda2193521f7e5b641467b51f6d 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.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 8d0eb590bf..654e5b7c03 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -169,6 +169,11 @@ static bool should_unload_system_driver(egl_connection_t* cnx) {
}
}
+ // Return true if native GLES drivers should be used and ANGLE is already loaded.
+ if (android::GraphicsEnv::getInstance().shouldUseNativeDriver() && cnx->angleLoaded) {
+ return true;
+ }
+
// Return true if updated driver namespace is set.
ns = android::GraphicsEnv::getInstance().getDriverNamespace();
if (ns) {
@@ -240,16 +245,28 @@ void* Loader::open(egl_connection_t* cnx) {
if (!hnd) {
// Secondly, try to load from driver apk.
hnd = attempt_to_load_updated_driver(cnx);
+
+ // If updated driver apk is set but fail to load, abort here.
+ LOG_ALWAYS_FATAL_IF(android::GraphicsEnv::getInstance().getDriverNamespace(),
+ "couldn't find an OpenGL ES implementation from %s",
+ android::GraphicsEnv::getInstance().getDriverPath().c_str());
}
+ // Attempt to load native GLES drivers specified by ro.hardware.egl if native is selected.
+ // If native is selected but fail to load, abort.
+ if (!hnd && android::GraphicsEnv::getInstance().shouldUseNativeDriver()) {
+ auto driverSuffix = base::GetProperty(RO_DRIVER_SUFFIX_PROPERTY, "");
+ LOG_ALWAYS_FATAL_IF(driverSuffix.empty(),
+ "Native GLES driver is selected but not specified in %s",
+ RO_DRIVER_SUFFIX_PROPERTY);
+ hnd = attempt_to_load_system_driver(cnx, driverSuffix.c_str(), true);
+ LOG_ALWAYS_FATAL_IF(!hnd, "Native GLES driver is selected but failed to load. %s=%s",
+ RO_DRIVER_SUFFIX_PROPERTY, driverSuffix.c_str());
+ }
+
+ // Finally, try to load default driver.
bool failToLoadFromDriverSuffixProperty = false;
if (!hnd) {
- // If updated driver apk is set but fail to load, abort here.
- if (android::GraphicsEnv::getInstance().getDriverNamespace()) {
- LOG_ALWAYS_FATAL("couldn't find an OpenGL ES implementation from %s",
- android::GraphicsEnv::getInstance().getDriverPath().c_str());
- }
- // Finally, try to load system driver.
// Start by searching for the library name appended by the system
// properties of the GLES userspace driver in both locations.
// i.e.: