summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tim Van Patten <timvp@google.com> 2021-03-05 21:15:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-03-05 21:15:55 +0000
commitdbefc04ca09b6cc8c866879cdea79fd4d3edf1ae (patch)
tree590a7c516a79b0fde35f599ae981a5fa52efa825
parent5f0632805060b62c453ef1ec92aec966386f5b3c (diff)
parent0222871bc87d9e844315d8a40df4a84f36665ca2 (diff)
Merge "Read ro.hardware.egl for ANGLE's filename" into sc-dev
-rw-r--r--opengl/libs/EGL/egl_angle_platform.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/opengl/libs/EGL/egl_angle_platform.cpp b/opengl/libs/EGL/egl_angle_platform.cpp
index c29181d715..d38f2eff01 100644
--- a/opengl/libs/EGL/egl_angle_platform.cpp
+++ b/opengl/libs/EGL/egl_angle_platform.cpp
@@ -22,6 +22,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <EGL/Platform.h>
#pragma GCC diagnostic pop
+
+#include <android-base/properties.h>
#include <android/dlext.h>
#include <dlfcn.h>
#include <graphicsenv/GraphicsEnv.h>
@@ -33,7 +35,6 @@
namespace angle {
-constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
constexpr int kAngleDlFlags = RTLD_LOCAL | RTLD_NOW;
static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr;
@@ -107,18 +108,36 @@ 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,
};
so = android_dlopen_ext(kAngleEs2Lib, kAngleDlFlags, &dlextinfo);
+ if (so) {
+ ALOGD("dlopen_ext from APK (%s) success at %p", kAngleEs2Lib, so);
+ } else {
+ ALOGE("dlopen_ext(\"%s\") failed: %s", kAngleEs2Lib, dlerror());
+ return false;
+ }
} else {
// If we are here, ANGLE is loaded as built-in gl driver in the sphal.
- so = android_load_sphal_library(kAngleEs2Lib, kAngleDlFlags);
- }
- if (!so) {
- ALOGE("%s failed to dlopen %s!", __FUNCTION__, kAngleEs2Lib);
- return false;
+ // 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);
+ if (so) {
+ ALOGD("dlopen (%s) success at %p", angleEs2LibName.c_str(), so);
+ } else {
+ ALOGE("%s failed to dlopen %s!", __FUNCTION__, angleEs2LibName.c_str());
+ return false;
+ }
}
angleGetDisplayPlatform =