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

Commit a348fabf authored by Jesse Hall's avatar Jesse Hall Committed by Android (Google) Code Review
Browse files

Merge "libEGL: Add initialization tracing" into nyc-mr2-dev-plus-aosp

parents f0ad7966 1508ae60
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include <array>
#include <ctype.h>
@@ -29,6 +30,7 @@
#include <android/dlext.h>
#include <cutils/properties.h>
#include <log/log.h>
#include <utils/Trace.h>

#include <EGL/egl.h>

@@ -118,6 +120,11 @@ static char const * getProcessCmdline() {
    return NULL;
}

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

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

Loader::driver_t::driver_t(void* gles)
@@ -181,7 +188,7 @@ Loader::~Loader() {
}

static void* load_wrapper(const char* path) {
    void* so = dlopen(path, RTLD_NOW | RTLD_LOCAL);
    void* so = do_dlopen(path, RTLD_NOW | RTLD_LOCAL);
    ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror());
    return so;
}
@@ -228,6 +235,8 @@ static void setEmulatorGlesValue(void) {

void* Loader::open(egl_connection_t* cnx)
{
    ATRACE_CALL();

    void* dso;
    driver_t* hnd = 0;

@@ -273,6 +282,8 @@ void Loader::init_api(void* dso,
        __eglMustCastToProperFunctionPointerType* curr,
        getProcAddressType getProcAddress)
{
    ATRACE_CALL();

    const ssize_t SIZE = 256;
    char scrap[SIZE];
    while (*api) {
@@ -325,6 +336,7 @@ void Loader::init_api(void* dso,
}

static void* load_system_driver(const char* kind) {
    ATRACE_CALL();
    class MatchFile {
    public:
        static String8 find(const char* kind) {
@@ -440,7 +452,7 @@ static void* load_system_driver(const char* kind) {
    }
    const char* const driver_absolute_path = absolutePath.string();

    void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);
    void* dso = do_dlopen(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");
@@ -452,12 +464,18 @@ static void* load_system_driver(const char* kind) {
    return dso;
}

static void* do_android_dlopen_ext(const char* path, int mode, const android_dlextinfo* info) {
    ATRACE_CALL();
    return android_dlopen_ext(path, mode, info);
}

static const std::array<const char*, 2> HAL_SUBNAME_KEY_PROPERTIES = {{
    "ro.hardware.egl",
    "ro.board.platform",
}};

static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
    ATRACE_CALL();
    const android_dlextinfo dlextinfo = {
        .flags = ANDROID_DLEXT_USE_NAMESPACE,
        .library_namespace = ns,
@@ -468,7 +486,7 @@ static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
        if (property_get(key, prop, nullptr) > 0) {
            String8 name;
            name.appendFormat("lib%s_%s.so", kind, prop);
            so = android_dlopen_ext(name.string(), RTLD_LOCAL | RTLD_NOW,
            so = do_android_dlopen_ext(name.string(), RTLD_LOCAL | RTLD_NOW,
                    &dlextinfo);
            if (so)
                return so;
@@ -480,6 +498,8 @@ static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
void *Loader::load_driver(const char* kind,
        egl_connection_t* cnx, uint32_t mask)
{
    ATRACE_CALL();

    void* dso = nullptr;
    if (mGetDriverNamespace) {
        android_namespace_t* ns = mGetDriverNamespace();
+1 −0
Original line number Diff line number Diff line
@@ -267,6 +267,7 @@ static inline EGLContext getContext() { return egl_tls_t::getContext(); }

EGLDisplay eglGetDisplay(EGLNativeDisplayType display)
{
    ATRACE_CALL();
    clearError();

    uintptr_t index = reinterpret_cast<uintptr_t>(display);
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#define __STDC_LIMIT_MACROS 1
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include <string.h>

@@ -26,6 +27,7 @@
#include "egl_tls.h"
#include "Loader.h"
#include <cutils/properties.h>
#include <utils/Trace.h>

// ----------------------------------------------------------------------------
namespace android {
@@ -103,6 +105,7 @@ EGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) {
EGLDisplay egl_display_t::getDisplay(EGLNativeDisplayType display) {

    Mutex::Autolock _l(lock);
    ATRACE_CALL();

    // get our driver loader
    Loader& loader(Loader::getInstance());