Failing to find egl function pointers on SDK 3.2 PVRTrace

Hello,

I’m trying to get the PVRTrace utility running on my ArmHF TI Pandaboard using SDK 3.2. The problem I’m running into is that the EGL library stubs all seem to fail loading. My application links GLES2 and EGL as /usr/lib/libGLESv2.so.1.9.6.0 and /usr/lib/libGLESv1_CM.so.1.9.6.0 as shown by ldd. I have taken the PowerVR/GraphicsSDK/PVRTrace/Recorder/Linux_armhf libs and moved them all to the target’s /usr/local/lib and updated them to name match what ldd wanted for my application. I’ve also updated LD_LIBRARY_PATH to point to the /usr/local/lib like the docs mention. The full name to the original drivers is in the pvrtrace.cfg as shown below. They seem to be found just fine but at loading time the application can’t find the EGL stubs.



Here is the output when the app loads:



root@localhost:/usr/lib# run

PVRTRACE(M) The current working directory is /usr/lib

PVRTRACE(W) WARNING: Config file not found in current directory. Checking libPVRTrace.so directory.

PVRTRACE(M) Config file found: /usr/local/lib/pvrtrace.cfg



PVRTRACE(M) Config File HostEs1LibPath: /usr/lib/libGLESv1_CM.so.1.9.6.0

PVRTRACE(M) Config File HostEs2LibPath: /usr/lib/libGLESv2.so.1.9.6.0

PVRTRACE(M) Config File HostEs3LibPath:

PVRTRACE(M) Opening trace file to record: /usr/local/bin/trace.pvrt



PVRTRACE(M) Loading host library '/usr/lib/libIMGegl.so.1.9.6.0’

PVRTRACE(M) Host library ‘/usr/lib/libIMGegl.so.1.9.6.0’ loaded

PVRTRACE(M) Error loading library eglChooseConfig

PVRTRACE(M) Error loading library eglCopyBuffers

PVRTRACE(M) Error loading library eglCreateContext

PVRTRACE(M) Error loading library eglCreatePbufferSurface

PVRTRACE(M) Error loading library eglCreatePixmapSurface

PVRTRACE(M) Error loading library eglCreateWindowSurface

PVRTRACE(M) Error loading library eglDestroyContext

PVRTRACE(M) Error loading library eglDestroySurface

PVRTRACE(M) Error loading library eglGetConfigAttrib

PVRTRACE(M) Error loading library eglGetConfigs

PVRTRACE(M) Error loading library eglGetCurrentContext

PVRTRACE(M) Error loading library eglGetCurrentDisplay

PVRTRACE(M) Error loading library eglGetCurrentSurface

PVRTRACE(M) Error loading library eglGetDisplay

PVRTRACE(M) Error loading library eglGetError

PVRTRACE(M) Error loading library eglGetProcAddress

PVRTRACE(M) Error loading library eglInitialize

PVRTRACE(M) Error loading library eglMakeCurrent

PVRTRACE(M) Error loading library eglQueryContext

PVRTRACE(M) Error loading library eglQueryString

PVRTRACE(M) Error loading library eglQuerySurface

PVRTRACE(M) Error loading library eglSwapBuffers

PVRTRACE(M) Error loading library eglTerminate

PVRTRACE(M) Error loading library eglWaitGL

PVRTRACE(M) Error loading library eglWaitNative

PVRTRACE(M) Error loading library eglBindTexImage

PVRTRACE(M) Error loading library eglReleaseTexImage

PVRTRACE(M) Error loading library eglSurfaceAttrib

PVRTRACE(M) Error loading library eglSwapInterval

PVRTRACE(M) Error loading library eglBindAPI

PVRTRACE(M) Error loading library eglCreatePbufferFromClientBuffer

PVRTRACE(M) Error loading library eglQueryAPI

PVRTRACE(M) Error loading library eglReleaseThread

PVRTRACE(M) Error loading library eglWaitClient

PVRTRACE(M) PVRTrace EGL - ERROR: failed to load entry points from host library

Please check library paths in pvrtrace.cfg



PVRTRACE(M)

PVRTrace - aborting





Am I missing an option in the pvrtrace.cfg or perhaps there is a driver mismatch between the stub and the libIMGegl.so.1.9.6.0 that came with my system?



Thanks,

Brant

Hi Brant,



These lines:

"PVRTRACE(M) PVRTrace EGL - ERROR: failed to load entry points from host library

Please check library paths in pvrtrace.cfg"

indicate that the library path for EGL is either not present or incorrect in the config.



From the top line:

"PVRTRACE(M) Loading host library ‘/usr/lib/libIMGegl.so.1.9.6.0’"

You can see that there is an EGL library loaded, but this is not the EGL library available to applications. Instead PVRTrace should be linking to libEGL.so, which is typically in the same place as the GLES libraries (/usr/lib/).



The line you should have in your path, as per the documentation should probably be this or something like it:

EglLibraryPath = /usr/lib/libEGL.so



Regards,

Tobias

Hi Tobias,

This helped me make it to the next step, thank you. I am able to run now, but when my EGL contexts get created I see a segfault. I don’t see this without the profiling libraries. Perhaps this log will should something else I may be doing wrong?



[Thread debugging using libthread_db enabled]

Using host libthread_db library “/lib/arm-linux-gnueabihf/libthread_db.so.1”.

PVRTRACE(M) The current working directory is /usr/local/bin

PVRTRACE(W) WARNING: Config file not found in current directory. Checking libPVRTrace.so directory.

PVRTRACE(M) Config file found: /usr/local/lib/pvrtrace.cfg

PVRTRACE(M) Config File HostEs1LibPath: libGLES_CM.so

PVRTRACE(M) Config File HostEs2LibPath: /usr/lib/libGLESv2.so.1.9.6.0

PVRTRACE(M) Config File HostEs3LibPath:

PVRTRACE(M) Opening trace file to record: /usr/local/bin/trace.pvrt

PVRTRACE(M) Loading host library '/usr/lib/libEGL.so.1’

PVRTRACE(M) Host library ‘/usr/lib/libEGL.so.1’ loaded

PVRTRACE(M) Loading host library 'libGLES_CM.so’

PVRTRACE(M) Host library ‘libGLES_CM.so’ loaded

PVRTRACE(M) Loading host library '/usr/lib/libGLESv2.so.1.9.6.0’

PVRTRACE(M) Host library ‘/usr/lib/libGLESv2.so.1.9.6.0’ loaded

PVR:(Warning): PVRSRVOpenDCDevice: Warning - 138 returned [80, /bridged_pvr_dc_glue.c]



Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread 0xb51a0460 (LWP 1841)]

0xb541c8b0 in CEglRenderState::CreateContext_Helper(void*, void*, void*, void*, int*, int*) () from /usr/local/lib/libPVRTrace.so

(gdb) bt

#0 0xb541c8b0 in CEglRenderState::CreateContext_Helper(void*, void*, void*, void*, int*, int*) () from /usr/local/lib/libPVRTrace.so

#1 0xb54151b0 in Egl::_eglCreateContext(void*, void*, void*, int const*, void*, void*) () from /usr/local/lib/libPVRTrace.so

#2 0xb6505492 in eglCreateContext () from /usr/local/lib/libEGL.so.1

#3 0xb692821e in EGLWindow::CreateWindow (this=0x221d8, config=…)

at /home/brant/hitachi/xorn/player/source/porting_layer/graphics/opengl/egl_window.cpp:272



I ran this in GDB to see which API was crashing. I should note on the panda board TI tells us to run pvrsrvinit and insmod the driver object to get it loaded before using graphics on the OMAP 5. Thats not necessarily related but may be useful.



Thank you for your help.


Hi,



Can you share your pvrtrace.cfg with us?



Thanks,

Joe

Gladly.



EglLibraryPath = /usr/lib/libEGL.so.1

ES1LibraryPath = /usr/lib/libGLESv1_CM.so.1.9.6.0

Es2LibraryPath = /usr/lib/libGLESv2.so.1.9.6.0

TraceFile = /usr/local/bin/trace.pvrt

RecordData = 1

StartFrame = 0

EndFrame = 100

SaveFileToDisk = 1



Thanks,

Brant

Those settings look ok. Can you share the details of the EGL config that was used with recording enabled and without recording enabled?



Thanks,

Joe

Sure. I am using the same configuration for both:



/* EGL configuration options specifed as an array. */

EGLint config_attrs[19];

int index=0;



config_attrs[index++] = EGL_BUFFER_SIZE;

config_attrs[index++] = EGL_DONT_CARE;

config_attrs[index++] = EGL_RED_SIZE;

config_attrs[index++] = 8;

config_attrs[index++] = EGL_GREEN_SIZE;

config_attrs[index++] = 8;

config_attrs[index++] = EGL_BLUE_SIZE;

config_attrs[index++] = 8;

config_attrs[index++] = EGL_ALPHA_SIZE;

config_attrs[index++] = 8;

config_attrs[index++] = EGL_RENDERABLE_TYPE;

config_attrs[index++] = EGL_OPENGL_ES2_BIT;

config_attrs[index] = EGL_NONE;



EGLint const context_attrs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};



EGLint match_count = 0;

VDVD_ASSERT_REPORT_ERROR(eglChooseConfig(egl_display, config_attrs, &egl_config, 1, &match_count), VDVD_FAILURE);

VDVD_ASSERT_ERROR(match_count >= 1, VDVD_FAILURE);





Thanks,

Brant

Hi Joe,

Do you have any recommendations on what might be wrong here or what I should try next?



Thanks,

Brant

Hi,



I’m not sure the reason behind the crash as everything looks ok. Would it be possible for you to let us know the values that are being passed to eglCreateContext? Maybe something unexpected is happening there. Also, if possible could you send some source code or a Linux X86 binary (unfortunately we don’t currently have an arm hf platform setup) that reproduces the issue to devtech@imgtec.com then we can have a closer look at what is happening.



Cheers,



Scott