Slow loading of OpenGL ES Vivante Library on iMX6 Board with Android

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Slow loading of OpenGL ES Vivante Library on iMX6 Board with Android

Jump to solution
2,928 Views
yufengzhang
Contributor II

Hi,

We have a custom Android app in which during its start-up the loading of the OpenGL ES Vivante library files can take up to 3 seconds to finish.  See the following logcat snippet:

01-02 00:06:16.650 3509 3509 D libEGL : loaded /system/lib/egl/libEGL_VIVANTE.so

01-02 00:06:18.810 3509 3509 D libEGL : loaded /system/lib/egl/libGLESv1_CM_VIVANTE.so

01-02 00:06:18.880 3509 3509 D libEGL : loaded /system/lib/egl/libGLESv2_VIVANTE.so

The environment is android_kk4.4.2_1.0.0-ga running on i.MX6 Quad board.

Can anyone please advise on the cause and potential solution, or what the best way is in order to carry out further investigation on this issue?

Best regards,

Yufeng

Labels (3)
0 Kudos
1 Solution
1,712 Views
yufengzhang
Contributor II

Hi Libo,

Apologize for the late response, the issue was finally resolved by my client who received an updated drop of the OpenGL libraries from Freescale. Clearly, this is an issue in the graphics drivers. Our internal investigation also found out that this problem does not occur in the Android 5.1 BSP.

Hope this help.

Best regards,

Yufeng

View solution in original post

0 Kudos
9 Replies
1,712 Views
liulibo
Contributor I

Hi, Yu feng, 

       I met the same problem。Did you solve it ? Can you communicate with me。qq/weixin:76273091

0 Kudos
1,713 Views
yufengzhang
Contributor II

Hi Libo,

Apologize for the late response, the issue was finally resolved by my client who received an updated drop of the OpenGL libraries from Freescale. Clearly, this is an issue in the graphics drivers. Our internal investigation also found out that this problem does not occur in the Android 5.1 BSP.

Hope this help.

Best regards,

Yufeng

0 Kudos
1,712 Views
liulibo
Contributor I

Hi Yufeng

       Thank you for your response.Could you please send OpenGL libraries to me(Email:llb1119@163.com),thank you very much.

0 Kudos
1,712 Views
yufengzhang
Contributor II

I'm afraid that you will have to contact NXP/Freescale for those OpenGL libraries. I don't have them and even if I had, I would not be allowed to distribute them.

0 Kudos
1,712 Views
yufengzhang
Contributor II

OK. Instrumented the loading of /libEGL_VIVANTE.so and the symbol resolving.

Looks like that the first time eglGetProcAddress() is called, it took more than 3 seconds to finish!!!!

Anyone has any suggestion? So weird!

01-02 00:04:22.880  3528  3528 D libEGL  : loaded /system/lib/egl/libEGL_VIVANTE.so

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetDisplay

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglInitialize

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglTerminate

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetConfigs

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglChooseConfig

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetConfigAttrib

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreateWindowSurface

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreatePixmapSurface

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreatePbufferSurface

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglDestroySurface

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglQuerySurface

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreateContext

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglDestroyContext

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglMakeCurrent

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetCurrentContext

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetCurrentSurface

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetCurrentDisplay

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglQueryContext

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglWaitGL

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglWaitNative

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglSwapBuffers

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCopyBuffers

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetError

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglQueryString

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetProcAddress

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglSurfaceAttrib

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglBindTexImage

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglReleaseTexImage

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglSwapInterval

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglBindAPI

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglQueryAPI

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglWaitClient

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglReleaseThread

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreatePbufferFromClientBuffer

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglLockSurfaceKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglUnlockSurfaceKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreateImageKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglDestroyImageKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglCreateSyncKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglDestroySyncKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglClientWaitSyncKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglSignalSyncKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglGetSyncAttribKHR

01-02 00:04:22.880  3528  3528 D libEGL  :    ----

01-02 00:04:22.880  3528  3528 D libEGL  :    Process eglWaitSyncKHR

01-02 00:04:22.880  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglSetSwapRectangleANDROID

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglGetRenderBufferANDROID

01-02 00:04:26.170  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglDupNativeFenceFDANDROID

01-02 00:04:26.170  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglGetSystemTimeFrequencyNV

01-02 00:04:26.170  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglGetSystemTimeNV

01-02 00:04:26.170  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglHibernateProcessIMG

01-02 00:04:26.170  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  :    Process eglAwakenProcessIMG

01-02 00:04:26.170  3528  3528 D libEGL  :      Call getProcAddress

01-02 00:04:26.170  3528  3528 D libEGL  :    ----

01-02 00:04:26.170  3528  3528 D libEGL  : #### finish resolving /system/lib/egl/libEGL_VIVANTE.so

01-02 00:04:26.170  3528  3528 D libEGL  : loaded /system/lib/egl/libGLESv1_CM_VIVANTE.so

01-02 00:04:26.240  3528  3528 D libEGL  : #### finish resolving /system/lib/egl/libGLESv1_CM_VIVANTE.so

01-02 00:04:26.240  3528  3528 D libEGL  : loaded /system/lib/egl/libGLESv2_VIVANTE.so

01-02 00:04:26.300  3528  3528 D libEGL  : #### finish resolving /system/lib/egl/libGLESv2_VIVANTE.so

0 Kudos
1,712 Views
yufengzhang
Contributor II

I have a suspicion that something weird may have happened during the function symbol resolving during the loading stage of the opengl libraries:

See /frameworks/native/opengl/libs/EGL/Loader.cpp (http://androidxref.com/4.4.2_r2/xref/frameworks/native/opengl/libs/EGL/Loader.cpp#261)

362    void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);

363    if (dso == 0) {

364        const char* err = dlerror();

365        ALOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown");

366        return 0;

367    }

368

369    ALOGD("loaded %s", driver_absolute_path);

370

371    if (mask & EGL) {

372        getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");

373

374        ALOGE_IF(!getProcAddress,

375                "can't find eglGetProcAddress() in %s", driver_absolute_path);

376

377        egl_t* egl = &cnx->egl;

378        __eglMustCastToProperFunctionPointerType* curr =

379            (__eglMustCastToProperFunctionPointerType*)egl;

380        char const * const * api = egl_names;

381        while (*api) {

382            char const * name = *api;

383            __eglMustCastToProperFunctionPointerType f =

384                (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);

385            if (f == NULL) {

386                // couldn't find the entry-point, use eglGetProcAddress()

387                f = getProcAddress(name);

388                if (f == NULL) {

389                    f = (__eglMustCastToProperFunctionPointerType)0;

390                }

391            }

392            *curr++ = f;

393            api++;

394        }

395    }

Any thought?

Is there a way to get the latest VIVANTE vendor opengl libraries for android_kk4.4.2_1.0.0-ga on i.MX6 Quad board?

Thanks,

Yufeng

0 Kudos
1,712 Views
yufengzhang
Contributor II

Using the Android DDMS tool, it looks like /frameworks/base/opengl/java/com/google/android/gles_jni/EGLImpl.java: eglGetDisplay() takes more than 3 seconds to finish. Really?!

I probably need to insert some instrument code in /frameworks/native/opengl/libs/EGL/Loader.cpp

eglGetDisplay.png

0 Kudos
1,712 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Yufeng,

In general you can debug your kernel by enabling debug output or adding printk's Did you turn on DEBUG flag in GPU driver kernel side? It may help.

Links that might help:

http://jas-hacks.blogspot.co.uk/2013/10/imx6-ubuntu-1304-debugging-gpu.html

Hope this helps

0 Kudos
1,712 Views
yufengzhang
Contributor II

Hi,

Thank you for the your help.

In general you can debug your kernel by enabling debug output or adding printk's Did you turn on DEBUG flag in GPU driver kernel side? It may help.

Can you shed some more light on how to turn on the DEBUG flag in the GPU driver at the kernel side?

Best regards,

Yufeng

0 Kudos