summaryrefslogtreecommitdiff
path: root/opengl
diff options
context:
space:
mode:
authorPeiyong Lin <lpy@google.com>2023-09-06 19:55:45 +0000
committerPeiyong Lin <lpy@google.com>2023-10-20 19:34:06 +0000
commit277f6f95fa85f169e2d89af0854744e7af9484a1 (patch)
tree2b568aacd2df3ca074f05b7d72939252d36d97c7 /opengl
parent287b271dd03d9b2c10f6d384d096a31ba3514919 (diff)
downloadnative-277f6f95fa85f169e2d89af0854744e7af9484a1.tar.gz
[Cherry-pick] Make sure the correct ANGLE binary is used.
Previously when eglGetDisplay is called, the code would attempt to initialize ANGLE platform methods and acquire pointers to reset the ANGLE platform. However, without this patch we continue using ro.hardware.egl to form the ANGLE binary name, which is now wrong. Not being able to correctly load the ANGLE binaries means platform methods are not initialize. This currently doesn't have known side effect except that we are observing a bunch of error messages that don't make sense that point to the native OpenGL ES driver loading failure. This patch makes sure ANGLE binary is used when initialize ANGLE platform. Bug: b/293503000 Test: atest CtsAngleIntegrationHostTestCases -c Change-Id: I5189042efc41fa7bef06d20f43ed4da3b1271dab Merged-In: I5189042efc41fa7bef06d20f43ed4da3b1271dab
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/egl_angle_platform.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/opengl/libs/EGL/egl_angle_platform.cpp b/opengl/libs/EGL/egl_angle_platform.cpp
index 9a6bb7a61c..ee605c2011 100644
--- a/opengl/libs/EGL/egl_angle_platform.cpp
+++ b/opengl/libs/EGL/egl_angle_platform.cpp
@@ -35,6 +35,7 @@
namespace angle {
+constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
constexpr int kAngleDlFlags = RTLD_LOCAL | RTLD_NOW;
static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr;
@@ -115,8 +116,6 @@ bool initializeAnglePlatform(EGLDisplay dpy) {
android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
void* so = nullptr;
if (ns) {
- // Loading from an APK, so hard-code the suffix to "_angle".
- constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
const android_dlextinfo dlextinfo = {
.flags = ANDROID_DLEXT_USE_NAMESPACE,
.library_namespace = ns,
@@ -130,19 +129,11 @@ bool initializeAnglePlatform(EGLDisplay dpy) {
}
} else {
// If we are here, ANGLE is loaded as built-in gl driver in the sphal.
- // Get the specified ANGLE library filename suffix.
- std::string angleEs2LibSuffix = android::base::GetProperty("ro.hardware.egl", "");
- if (angleEs2LibSuffix.empty()) {
- ALOGE("%s failed to get valid ANGLE library filename suffix!", __FUNCTION__);
- return false;
- }
-
- std::string angleEs2LibName = "libGLESv2_" + angleEs2LibSuffix + ".so";
- so = android_load_sphal_library(angleEs2LibName.c_str(), kAngleDlFlags);
+ so = android_load_sphal_library(kAngleEs2Lib, kAngleDlFlags);
if (so) {
- ALOGD("dlopen (%s) success at %p", angleEs2LibName.c_str(), so);
+ ALOGD("dlopen (%s) success at %p", kAngleEs2Lib, so);
} else {
- ALOGE("%s failed to dlopen %s!", __FUNCTION__, angleEs2LibName.c_str());
+ ALOGE("%s failed to dlopen %s: %s!", __FUNCTION__, kAngleEs2Lib, dlerror());
return false;
}
}