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

Commit 7cc58921 authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

Make a GLESv1 only entries for GLESv1 driver loading

This change creates a separate entry list for initializing gles1 apis
from the driver. With this change, the gl driver loading time for one
particular device reduced from ~180ms to ~40ms.

Bug: b/117526831
Test: dEQP-EGL.* and systrace on multiple devices
Change-Id: Ic2f6f1b8f4cd8f17db64b6e288769e2d6a7859eb
parent a3ccde8b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ void Loader::close(void* driver)

void Loader::init_api(void* dso,
        char const * const * api,
        char const * const * ref_api,
        __eglMustCastToProperFunctionPointerType* curr,
        getProcAddressType getProcAddress)
{
@@ -282,6 +283,15 @@ void Loader::init_api(void* dso,
    char scrap[SIZE];
    while (*api) {
        char const * name = *api;
        if (ref_api) {
            char const * ref_name = *ref_api;
            if (std::strcmp(name, ref_name) != 0) {
                *curr++ = nullptr;
                ref_api++;
                continue;
            }
        }

        __eglMustCastToProperFunctionPointerType f =
            (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
        if (f == nullptr) {
@@ -326,6 +336,7 @@ void Loader::init_api(void* dso,
        }
        *curr++ = f;
        api++;
        if (ref_api) ref_api++;
    }
}

@@ -648,14 +659,14 @@ void *Loader::load_driver(const char* kind,
    }

    if (mask & GLESv1_CM) {
        init_api(dso, gl_names,
        init_api(dso, gl_names_1, gl_names,
            (__eglMustCastToProperFunctionPointerType*)
                &cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl,
            getProcAddress);
    }

    if (mask & GLESv2) {
      init_api(dso, gl_names,
        init_api(dso, gl_names, nullptr,
            (__eglMustCastToProperFunctionPointerType*)
                &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
            getProcAddress);
+9 −8
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ private:
    static __attribute__((noinline))
    void init_api(void* dso,
            char const * const * api,
            char const * const * ref_api,
            __eglMustCastToProperFunctionPointerType* curr,
            getProcAddressType getProcAddress);
};
+5 −0
Original line number Diff line number Diff line
@@ -252,6 +252,11 @@ char const * const gl_names[] = {
    nullptr
};

char const * const gl_names_1[] = {
    #include "../entries_gles1.in"
    nullptr
};

char const * const egl_names[] = {
    #include "egl_entries.in"
    nullptr
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ extern "C" void gl_unimplemented();
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 egl_connection_t gEGLImpl;
+298 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading