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

Commit 9d5d33d6 authored by Cody Northrop's avatar Cody Northrop
Browse files

Move platform entries init earlier

Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Test: Chromium starts up
Test: deqp - EGL, GLES2, GLES3
Bug: 110883880
Change-Id: I07bdb9552c6cd568eef0aa0499bf8a027e404d34
parent 629ce4e1
Loading
Loading
Loading
Loading
+2 −21
Original line number Diff line number Diff line
@@ -238,12 +238,12 @@ void* Loader::open(egl_connection_t* cnx)

    setEmulatorGlesValue();

    dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2 | PLATFORM);
    dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2);
    if (dso) {
        hnd = new driver_t(dso);
    } else {
        // Always load EGL first
        dso = load_driver("EGL", cnx, EGL | PLATFORM);
        dso = load_driver("EGL", cnx, EGL);
        if (dso) {
            hnd = new driver_t(dso);
            hnd->set( load_driver("GLESv1_CM", cnx, GLESv1_CM), GLESv1_CM );
@@ -635,25 +635,6 @@ void *Loader::load_driver(const char* kind,
            return nullptr;
    }

    if (mask & PLATFORM) {
        // For each entrypoint tracked by the platform
        char const* const* entries = platform_names;
        EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&cnx->platform);

        while (*entries) {
            const char* name = *entries;
            EGLFuncPointer f = FindPlatformImplAddr(name);

            if (f == nullptr) {
                // If no entry found, update the lookup table: sPlatformImplMap
                ALOGE("No entry found in platform lookup table for %s", name);
            }

            *curr++ = f;
            entries++;
        }
    }

    if (mask & EGL) {
        getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");

+22 −2
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@
#define ANDROID_EGLDEFS_H

#include "../hooks.h"
#include "egl_platform_entries.h"

#include <log/log.h>

#define VERSION_MAJOR 1
#define VERSION_MINOR 4
@@ -31,13 +34,31 @@ const unsigned int NUM_DISPLAYS = 1;

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

extern char const * const platform_names[];

struct egl_connection_t {
    enum {
        GLESv1_INDEX = 0,
        GLESv2_INDEX = 1
    };

    inline egl_connection_t() : dso(nullptr) { }
    inline egl_connection_t() : dso(nullptr) {

        char const* const* entries = platform_names;
        EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform);
        while (*entries) {
            const char* name = *entries;
            EGLFuncPointer f = FindPlatformImplAddr(name);

            if (f == nullptr) {
                // If no entry found, update the lookup table: sPlatformImplMap
                ALOGE("No entry found in platform lookup table for %s", name);
            }

            *curr++ = f;
            entries++;
        }
    }

    void *              dso;
    gl_hooks_t *        hooks[2];
@@ -68,7 +89,6 @@ extern "C" void gl_noop();
extern char const * const gl_names[];
extern char const * const gl_names_1[];
extern char const * const egl_names[];
extern char const * const platform_names[];

extern egl_connection_t gEGLImpl;