Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9883129d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "OpenGL: fix initializeAnglePlatform with built-in ANGLE driver" am:...

Merge "OpenGL: fix initializeAnglePlatform with built-in ANGLE driver" am: f75a5aa1 am: 41f56f81 am: 9e25b96c

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1458682

Change-Id: I2ffad82210b9d863e7efdf9490de75161e05d3f3
parents 36549796 9e25b96c
Loading
Loading
Loading
Loading
+20 −5
Original line number Original line Diff line number Diff line
@@ -29,9 +29,13 @@
#include <graphicsenv/GraphicsEnv.h>
#include <graphicsenv/GraphicsEnv.h>
#include <time.h>
#include <time.h>
#include <log/log.h>
#include <log/log.h>
#include <vndksupport/linker.h>


namespace angle {
namespace angle {


constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
constexpr int kAngleDlFlags = RTLD_LOCAL | RTLD_NOW;

static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr;
static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr;
static ResetDisplayPlatformFunc angleResetDisplayPlatform = nullptr;
static ResetDisplayPlatformFunc angleResetDisplayPlatform = nullptr;


@@ -101,11 +105,22 @@ static void assignAnglePlatformMethods(PlatformMethods* platformMethods) {
bool initializeAnglePlatform(EGLDisplay dpy) {
bool initializeAnglePlatform(EGLDisplay dpy) {
    // Since we're inside libEGL, use dlsym to lookup fptr for ANGLEGetDisplayPlatform
    // Since we're inside libEGL, use dlsym to lookup fptr for ANGLEGetDisplayPlatform
    android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
    android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
    void* so = nullptr;
    if (ns) {
        const android_dlextinfo dlextinfo = {
        const android_dlextinfo dlextinfo = {
                .flags = ANDROID_DLEXT_USE_NAMESPACE,
                .flags = ANDROID_DLEXT_USE_NAMESPACE,
                .library_namespace = ns,
                .library_namespace = ns,
        };
        };
    void* so = android_dlopen_ext("libGLESv2_angle.so", RTLD_LOCAL | RTLD_NOW, &dlextinfo);
        so = android_dlopen_ext(kAngleEs2Lib, kAngleDlFlags, &dlextinfo);
    } 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;
    }

    angleGetDisplayPlatform =
    angleGetDisplayPlatform =
            reinterpret_cast<GetDisplayPlatformFunc>(dlsym(so, "ANGLEGetDisplayPlatform"));
            reinterpret_cast<GetDisplayPlatformFunc>(dlsym(so, "ANGLEGetDisplayPlatform"));