PVRTrace can not launch successfully

Hi,

I use the latest PVRTrace on a kind of Linux platform, seems it ignores LD_LIBRARY_PATH, I change to use LD_PRELOAD or replace the interception so files with the so files in the BSP(TI SOC). It can work well for the generic linux app, but not work for the app which I use node(v8) to launch. For example:

  1. export LD_PRELOAD=/pvr/libEGL.so:/pvr/libGLESv2.so:/pvr/libGLESv1_CM.so:/pvr/libGLES_CM.so:/pvr/libPVRTrace.so
  2. node --harmony index.js
    It will output the following errors:
    PVRTRACE(M) Config file found: /pvr/pvrtraceconfig.json

PVRTRACE(M) Opening trace file ‘/pvr/trace.pvrt’ for record recording.
PVRTRACE(M) ‘/pvr/trace.pvrt’ already exists so will be overwritten.
PVRTRACE(M) Recorder Version: 3.3@2964572
PVRTRACE(M) Loading host library '/pvr/libEGL.so.1.9.6.0’
PVRTRACE(M) Host library ‘/pvr/libEGL.so.1.9.6.0’ loaded
PVR:(Warning): LoadWSModule: Window system module libpvrws_KMS.so did not validate native display [98, /generic_ws.c]
PVR:(Warning): LoadWSModule: Window system module libpvrws_WAYLAND.so did not validate native display [98, /generic_ws.c]
PVR:(Error): Couldn’t load WS module libpvrws_OMAPDRI2.so [44, /generic_ws.c]
Aborted (core dumped)

What is wrong? Thanks!

The system info is as followings:
Copyright © Imagination Technologies Ltd. All rights reserved.

  • Support: DevTech@imgtec.com
  • OS: Linux version 3.14.31-00055-g4478b10 (jenkins@ubuntu76) (gcc version 4.7.3 20130226 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03) ) #1 SMP PREEMPT Thu Jun 18 05:05:25 CST 2015
  • Time (local): Sat Jan 1 00:41:09 2000 (00:41:09)
  • Time (UTC): Sat Jan 1 00:41:09 2000 (00:41:09)
  • DRIVER BUILD: 1.9.225.3347
  • Device Variant: PowerVR SGX544MP2
  • Device Series: PowerVR Series5XT
  • Processor count: 2
    This server is dra7xx-evm:6520 (lo:127.0.0.1)…

Could you attach your pvrtraceconfig.json?

It is :
{
“Debug”: {
“Level”: 1
},
“Host”: {
“EglLibraryPath”: “/usr/lib/libEGL.so”,
“Es1LibraryPath”: “/usr/lib/libGLESv1_CM.so”,
“Es2LibraryPath”: “/usr/lib/libGLESv2.so”
},
“Tracing”: {
“OutputFilename”: “/pvr/trace.pvrt”,
“RecordData”: true,
“OptimiseFileSize”: false,
“StartFrame”: 0,
“EndFrame”: 9,
“ExitOnLastFrame”: true,
“ClientBufferRecordFrequency”: 1,
“SaveFrameBuffer”: false
},
“Profiling”: {
“SoftwareCounters”: true,
“FunctionTimelineLevel”: 1,
“Enabled”: 0,
“RenderstateOverride”: true
},
“Network”: {
“Wait”: true,
“Enabled”: false,
“BufferSize”: 256
}
}

I find the error is because
EGLDisplay eglDisplay = eglGetDisplay(nativeDisplay);
return eglDisplay==0 and then fire an assert.

but eglGetError() shows EGL_SUCCESS, that means some error in the wrap layer in libEGL.so for node to launch the js. Any idea? Thanks!

If you run the application with tracing enabled does it run without issue?

Could I also check that the drivers pointed to by your traceconfig are the host drivers, not the PVRTrace shims?

If I run the app without
LD_PRELOAD=/pvr/libEGL.so:/pvr/libGLESv2.so:/pvr/libGLESv1_CM.so:/pvr/libGLES_CM.so:/pvr/libPVRTrace.so
it can run well.

I re-flash the whole image into the device and do not change any files under /usr/lib/. So the host driver should not be the PVRTrace ones. For example,
lrwxrwxrwx 1 root root 11 Jan 1 00:03 /usr/lib/libEGL.so -> libEGL.so.1
lrwxrwxrwx 1 root root 17 Jan 1 00:02 /usr/lib/libEGL.so.1 -> libEGL.so.1.9.6.0
-rw-r–r-- 1 root root 21914 Jul 26 2015 /usr/lib/libEGL.so.1.9.6.0

I am sure there are some issues in PVRTrace’s libEGL.so, in which eglGetDisplay return 0 for node and the real eglGetDisplay is not executed.

Can you double check that if any error checking path leads to this issue?

I try to ignore libEGL.so and use
LD_PRELOAD=/pvr/libGLESv2.so:/pvr/libGLESv1_CM.so:/pvr/libGLES_CM.so:/pvr/libPVRTrace.so

and find eglGetDisplay can work well. But Segmentation fault in libPVRTrace.so:
#0 0xb6f6b05e in std::map<unsigned int, VAODefinition, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, VAODefinition> > >::operator[](unsigned int const&) ()
from /opt/img-powervr-sdk/PVRHub/PVRTrace/Recorder/libPVRTrace.so
#1 0xb6f5f09c in Es2::_glBindBuffer(unsigned int, unsigned int) ()
from /opt/img-powervr-sdk/PVRHub/PVRTrace/Recorder/libPVRTrace.so

This proves that is correct:
“I am sure there are some issues in PVRTrace’s libEGL.so, in which eglGetDisplay return 0 for node and the real eglGetDisplay is not executed.”

Hi Oscar,
I just tried
export LD_PRELOAD=/home/kevin/IMG_SDK_LIB/PVRTrace/Linux_x86_64/libGLESv2.so:/home/kevin/IMG_SDK_LIB/PVRTrace/Linux_x86_64/libGLESv1_CM.so:/home/kevin/IMG_SDK_LIB/PVRTrace/Linux_x86_64/libGLES_CM.so:/home/kevin/IMG_SDK_LIB/PVRTrace/Linux_x86_64/libPVRTrace.so

It is work fine on my
Linux ImgBuild 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Thanks,
Kevin

Hi Oscar,

According to your output:
>>>>>>>>>>
PVRTRACE(M) Recorder Version: 3.3@2964572
PVRTRACE(M) Loading host library ‘/pvr/libEGL.so.1.9.6.0′
PVRTRACE(M) Host library ‘/pvr/libEGL.so.1.9.6.0′ loaded
<<<<<<<<<<
and your pvrtraceconfig.json
>>>>>>>>>>
“EglLibraryPath”: “/usr/lib/libEGL.so”,
<<<<<<<<<<
Seem like you loaded wrong host library. the right output should be like this:
>>>>>>>>>>
Loading host library '/usr/lib/libGLESv2.so’
Host library ‘/usr/lib/libGLESv2.so’ loaded
<<<<<<<<<<
Is that possible the program loaded a different json file?
or can you try to change your json file like the following:
>>>>>>>>>>
“Host”: {
“EglLibraryPath”: “/usr/lib/libEGL.so”,
“Es1LibraryPath”: “/usr/lib/libGLES_CM.so”,
“Es2LibraryPath”: “/usr/lib/libGLESv2.so”
},
<<<<<<<<<<
Thanks,
Kevin