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

Commit 8ac33bda authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "EGL: Do not look up default namespace when sphal is defined"

parents 62c2c12d b732030e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ cc_library_shared {
        "EGL/Loader.cpp",
        "EGL/BlobCache.cpp",
    ],
    shared_libs: ["libvndksupport"],
    static_libs: ["libEGL_getProcAddress"],
    ldflags: ["-Wl,--exclude-libs=ALL"],
    export_include_dirs: ["EGL/include"],
+9 −19
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <log/log.h>

#include <graphicsenv/GraphicsEnv.h>
#include <vndksupport/linker.h>

#include "egl_trace.h"
#include "egldefs.h"
@@ -115,6 +116,11 @@ static void* do_android_dlopen_ext(const char* path, int mode, const android_dle
    return android_dlopen_ext(path, mode, info);
}

static void* do_android_load_sphal_library(const char* path, int mode) {
    ATRACE_CALL();
    return android_load_sphal_library(path, mode);
}

// ----------------------------------------------------------------------------

Loader::driver_t::driver_t(void* gles)
@@ -424,27 +430,11 @@ static void* load_system_driver(const char* kind) {
    const char* const driver_absolute_path = absolutePath.c_str();

    // Try to load drivers from the 'sphal' namespace, if it exist. Fall back to
    // the original routine when the namespace does not exist or the load from
    // the namespace fails.
    // the original routine when the namespace does not exist.
    // See /system/core/rootdir/etc/ld.config.txt for the configuration of the
    // sphal namespace.
    android_namespace_t* sphal_namespace = android_get_exported_namespace("sphal");
    if (sphal_namespace != NULL) {
        const android_dlextinfo dlextinfo = {
            .flags = ANDROID_DLEXT_USE_NAMESPACE,
            .library_namespace = sphal_namespace,
        };
        void* dso = do_android_dlopen_ext(driver_absolute_path, RTLD_LOCAL | RTLD_NOW, &dlextinfo);
        if (dso) {
            ALOGD("loaded %s from sphal namespace", driver_absolute_path);
            return dso;
        }
        else {
            ALOGW("failed to load %s from sphal namespace: %s", driver_absolute_path, dlerror());
        }
    }

    void* dso = do_dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);
    void* dso = do_android_load_sphal_library(driver_absolute_path,
                                              RTLD_NOW | RTLD_LOCAL);
    if (dso == 0) {
        const char* err = dlerror();
        ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown");