diff options
author | 2023-04-06 21:46:10 +0000 | |
---|---|---|
committer | 2023-04-06 21:46:10 +0000 | |
commit | ecd41c772b9c76d6cb6f79c5b54cadc9093003d3 (patch) | |
tree | 894a39e64fbf1d0da7cf90833dabbf59a1a26706 | |
parent | d379634a839be187ddb1ca3e21a274dda4c6c77a (diff) | |
parent | 98db8e0c2301035c79a440b7cc5e18b318362319 (diff) |
Merge "Do not allow wildcard matching in GL loader." into udc-dev
-rw-r--r-- | opengl/libs/EGL/Loader.cpp | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 34b1251388..415e8eab70 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -21,6 +21,7 @@ #include <android-base/properties.h> #include <android/dlext.h> +#include <cutils/properties.h> #include <dirent.h> #include <dlfcn.h> #include <graphicsenv/GraphicsEnv.h> @@ -236,29 +237,22 @@ void* Loader::open(egl_connection_t* cnx) LOG_ALWAYS_FATAL("couldn't find an OpenGL ES implementation from %s", android::GraphicsEnv::getInstance().getDriverPath().c_str()); } - // Finally, try to load system driver. If ANGLE is the system driver - // (i.e. we are forcing the legacy system driver instead of ANGLE), use - // the driver suffix that was passed down from above. - if (shouldForceLegacyDriver) { - std::string suffix = android::GraphicsEnv::getInstance().getLegacySuffix(); - hnd = attempt_to_load_system_driver(cnx, suffix.c_str(), true); - } else { - // Start by searching for the library name appended by the system - // properties of the GLES userspace driver in both locations. - // i.e.: - // libGLES_${prop}.so, or: - // libEGL_${prop}.so, libGLESv1_CM_${prop}.so, libGLESv2_${prop}.so - for (auto key : HAL_SUBNAME_KEY_PROPERTIES) { - auto prop = base::GetProperty(key, ""); - if (prop.empty()) { - continue; - } - hnd = attempt_to_load_system_driver(cnx, prop.c_str(), true); - if (hnd) { - break; - } else if (strcmp(key, DRIVER_SUFFIX_PROPERTY) == 0) { - failToLoadFromDriverSuffixProperty = true; - } + // 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.: + // libGLES_${prop}.so, or: + // libEGL_${prop}.so, libGLESv1_CM_${prop}.so, libGLESv2_${prop}.so + for (auto key : HAL_SUBNAME_KEY_PROPERTIES) { + auto prop = base::GetProperty(key, ""); + if (prop.empty()) { + continue; + } + hnd = attempt_to_load_system_driver(cnx, prop.c_str(), true); + if (hnd) { + break; + } else if (strcmp(key, DRIVER_SUFFIX_PROPERTY) == 0) { + failToLoadFromDriverSuffixProperty = true; } } } @@ -272,7 +266,10 @@ void* Loader::open(egl_connection_t* cnx) hnd = attempt_to_load_system_driver(cnx, nullptr, true); } - if (!hnd && !failToLoadFromDriverSuffixProperty) { + if (!hnd && !failToLoadFromDriverSuffixProperty && + property_get_int32("ro.vendor.api_level", 0) < __ANDROID_API_U__) { + // Still can't find the graphics drivers with the exact name. This time try to use wildcard + // matching if the device is launched before Android 14. hnd = attempt_to_load_system_driver(cnx, nullptr, false); } |