diff options
Diffstat (limited to 'opengl/libs/EGL/egl_angle_platform.cpp')
-rw-r--r-- | opengl/libs/EGL/egl_angle_platform.cpp | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/opengl/libs/EGL/egl_angle_platform.cpp b/opengl/libs/EGL/egl_angle_platform.cpp index d38f2eff01..97dc0f1370 100644 --- a/opengl/libs/EGL/egl_angle_platform.cpp +++ b/opengl/libs/EGL/egl_angle_platform.cpp @@ -16,6 +16,7 @@ #if defined(__ANDROID__) +#include "Loader.h" #include "egl_angle_platform.h" #pragma GCC diagnostic push @@ -23,20 +24,14 @@ #include <EGL/Platform.h> #pragma GCC diagnostic pop -#include <android-base/properties.h> #include <android/dlext.h> #include <dlfcn.h> #include <graphicsenv/GraphicsEnv.h> -#include <log/log.h> #include <time.h> -#include <vndksupport/linker.h> - -#include "Loader.h" +#include <log/log.h> namespace angle { -constexpr int kAngleDlFlags = RTLD_LOCAL | RTLD_NOW; - static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr; static ResetDisplayPlatformFunc angleResetDisplayPlatform = nullptr; @@ -106,40 +101,11 @@ static void assignAnglePlatformMethods(PlatformMethods* platformMethods) { bool initializeAnglePlatform(EGLDisplay dpy) { // Since we're inside libEGL, use dlsym to lookup fptr for ANGLEGetDisplayPlatform 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. - // 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; - } - } - + const android_dlextinfo dlextinfo = { + .flags = ANDROID_DLEXT_USE_NAMESPACE, + .library_namespace = ns, + }; + void* so = android_dlopen_ext("libGLESv2_angle.so", RTLD_LOCAL | RTLD_NOW, &dlextinfo); angleGetDisplayPlatform = reinterpret_cast<GetDisplayPlatformFunc>(dlsym(so, "ANGLEGetDisplayPlatform")); @@ -149,11 +115,13 @@ bool initializeAnglePlatform(EGLDisplay dpy) { } angleResetDisplayPlatform = - reinterpret_cast<ResetDisplayPlatformFunc>(dlsym(so, "ANGLEResetDisplayPlatform")); + reinterpret_cast<ResetDisplayPlatformFunc>( + eglGetProcAddress("ANGLEResetDisplayPlatform")); PlatformMethods* platformMethods = nullptr; - if (!((angleGetDisplayPlatform)(dpy, g_PlatformMethodNames, g_NumPlatformMethods, nullptr, - &platformMethods))) { + if (!((angleGetDisplayPlatform)(dpy, g_PlatformMethodNames, + g_NumPlatformMethods, nullptr, + &platformMethods))) { ALOGE("ANGLEGetDisplayPlatform call failed!"); return false; } |