TDA4VM: RE: TDA4VM: OpenGL external texture input support on SDK9.2

Part Number: TDA4VM

Tool/software:

 Part number:TDA4VM

Software:opengl

 

Opengl supports rendering the camera using external textures on the 0900 system version. But on the 0902 release, opengl crashes every time at the position of the glDrawArrays() interface

[ 1839.821437] audit: type=1334 audit(1651182827.624:68): prog-id=34 op=UNLOAD
[ 1839.828430] audit: type=1334 audit(1651182827.624:69): prog-id=33 op=UNLOAD
Segmentation fault (core dumped)

  • Hello,

    We have tested the support for External EGL Images on all releases. Can you elaborate on your application? Are you using the utilities provided in our Vision Apps project? Or have you built your own code from this?

    If there is an issue with the state of OpenGL, I would assume there is a bug in the OpenGL code. Is there a way to isolate this code within your application? Are the dma-buf IDs correct and the EGL External Textures correctly constructed? If you could check by adding an glGetError and ensuring it is not reporting back any issue with the state? Similarly with eglGetError?

    Thanks,

    Erick

  • Hi Erick,

    Thanks for replay! First,we built our own code without using Vision Apps project ! But our code have be varifired in another tda4 SDK 0900, everthing is ok! and our code also have be test at v9m,Ambarella..;
    I use eglGetError() function, return 0, that means GL_NO_ERROR; The Code and log as follow:

    Code:

    enVTRet VTGLR_Image2DRender_ExtTex(GLuint Tex, stVTDScrnWin win)
    {
    LogHL("=======================================aaa");
    glm::mat4 Identity(1.0f);
    glViewport(win.x, 1080- win.height - win.y, win.width, win.height);
    LogHL("=======================================bbb");
    glEnable(GL_BLEND);
    glDisable(GL_DEPTH_TEST);
    LogHL("=======================================ccc");
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    //glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
    LogHL("=======================================ddd");
    glUseProgram(AVMShader_GetCommonProg(SHADER_PROG_EXT));
    LogHL("=======================================eee");
    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    LogHL("=======================================222");
    glBindVertexArray(VAO);
    glUniform1i(glGetUniformLocation(AVMShader_GetCommonProg(SHADER_PROG_EXT), "myTexture"), 0);
    LogHL("=======================================333");
    glUniformMatrix4fv(glGetUniformLocation(AVMShader_GetCommonProg(SHADER_PROG_EXT), "mvp"), 1, GL_FALSE, glm::value_ptr(Identity));
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_EXTERNAL_OES, Tex);
    LogHL("=======================================444");
    #if 0
    /* vertex array */
    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, VrtVBO);
    glVertexAttribPointer(0, 3, GL_FLOAT, 0, 0, 0);

    /* texcoord array */
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER, TexVBO);
    glVertexAttribPointer(1, 2, GL_FLOAT, 0, 0, 0);
    #endif
    LogHL("=======================================555");
    LogHL("=======================================VrtNum is %d",VrtNum);
    GLenum error;
    error = glGetError();
    LogHL("-------------OpenGL Error: %d" ,error);

    glDrawArrays(GL_TRIANGLES, 0, VrtNum);
    LogHL("=======================================666");

    LogHL("=======================================777");
    return VTRET_OK;
    }

    Log:
    [0580][VTGLR_Image2DRender_]=======================================000
    [0582][VTGLR_Image2DRender_]=======================================111
    [0583][VTGLR_Image2DRender_]=======================================CameraTex_[VT_CAMERA_FRONT][0]=2
    [0529][VTGLR_Image2DRender_ExtTex]=======================================aaa
    [0532][VTGLR_Image2DRender_ExtTex]=======================================bbb
    [0535][VTGLR_Image2DRender_ExtTex]=======================================ccc
    [0538][VTGLR_Image2DRender_ExtTex]=======================================ddd
    Enter Render Program object address: 0xffff689cc960
    [0540][VTGLR_Image2DRender_ExtTex]=======================================eee
    [0542][VTGLR_Image2DRender_ExtTex]=======================================222
    Enter Render Program object address: 0xffff689cc960
    [0545][VTGLR_Image2DRender_ExtTex]=======================================333
    Enter Render Program object address: 0xffff689cc960
    [0549][VTGLR_Image2DRender_ExtTex]=======================================444
    [0561][VTGLR_Image2DRender_ExtTex]=======================================555
    [0562][VTGLR_Image2DRender_ExtTex]=======================================VrtNum is 6
    [0565][VTGLR_Image2DRender_ExtTex]-------------OpenGL Error: 0
    [ 334.268716] audit: type=1334 audit(1651428332.648:33): prog-id=20 op=UNLOAD
    [ 334.275709] audit: type=1334 audit(1651428332.652:34): prog-id=19 op=UNLOAD
    run.sh: line 8: 1799 Segmentation fault (core dumped) ./avm_main

  • If i use SHAER_PROG_2D_IMG, eglDraw() will not system crash, So I consid the problem will be in shader part.
    static const vtint8 *VShader_Common =
    "attribute vec4 vPosition;\n"
    "attribute vec2 vTexCoord;\n"
    "uniform mat4 mvp;\n"
    "varying vec3 TexCoord;\n"
    "void main() {\n"
    " vec4 temPosition = mvp * vec4(vPosition.x, vPosition.y, vPosition.z, 1);\n"
    " gl_Position = vec4(temPosition.x, temPosition.y, temPosition.z, temPosition.a);\n"
    " TexCoord = vec3(vTexCoord, vPosition.w);\n"
    "}\n";

    static const vtint8 *FShader_Ext =
    "#extension GL_OES_EGL_image_external : require\n"
    "precision mediump float;\n"
    "uniform samplerExternalOES myTexture;\n"
    "varying vec3 TexCoord;\n"
    "uniform vec4 myGain;\n"
    "void main() {\n"
    " gl_FragColor = vec4(texture2D(myTexture, TexCoord.xy).rgb, TexCoord.z)+vec4(myGain.xyz,0.0);\n"
    "}\n";
    static const vtint8 *FShader_2DImg =
    "precision mediump float;\n"
    "uniform sampler2D myTexture;\n"
    "varying vec3 TexCoord;\n"
    "void main() {\n"
    " gl_FragColor = vec4(texture2D(myTexture, TexCoord.xy).bgra);\n"
    "}\n";
    static const vtint8 *FShader_2D =
    "precision mediump float;\n"
    "uniform sampler2D myTexture;\n"
    "varying vec3 TexCoord;\n"
    "uniform vec4 myGain;\n"
    "void main() {\n"
    " gl_FragColor = vec4(texture2D(myTexture, TexCoord.xy).rgb, TexCoord.z)+vec4(myGain.xyz,0.0);\n"
    "}\n"
    ;




  • Hello,

    Thanks for replay! First,we built our own code without using Vision Apps project ! But our code have be varifired in another tda4 SDK 0900, everthing is ok! and our code also have be test at v9m,Ambarella..;

    So, it is only crashing with one code base (SDK 9.2), but if you use another code base (another SDK 9.0 installation), you are not seeing the issue?

    I am not familiar with the Ambarella, is this an EVM/Custom board? OR is it a software solution? But you are saying the code works there as well?

    Are you able to build and run one of the other applications that use OpenGL? Like the app_srv_camera or app_srv_fileio? If these can run fine, then the issue must be somewhere in the application logic or the interconnects between your OpenGL node and the rest of the system.

    Regards,

    Erick

  • root@j721e-evm:/opt/vision_apps/test_data# ./vx_app_srv_fileio.out
    Test data path is NULL. Defaulting to current folder
    SRV Demo - (c) Texas Instruments 2019
    ========================================================
    Usage,
      ./vx_app_srv_fileio.out --cfg <config file>
    root@j721e-evm:/opt/vision_apps/test_data# ^C
    root@j721e-evm:/opt/vision_apps/test_data# ./vx_app_srv_fileio.out --cfg app.cfg
    Test data path is NULL. Defaulting to current folder
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=5) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
      4945.584865 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
      4945.584961 s:  VX_ZONE_INIT:Enabled
      4945.584969 s:  VX_ZONE_ERROR:Enabled
      4945.584975 s:  VX_ZONE_WARNING:Enabled
      4945.585576 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-0
      4945.585742 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-1
      4945.585851 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-2
      4945.585955 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-3
      4945.585966 s:  VX_ZONE_INIT:[tivxInitLocal:136] Initialization Done !!!
      4945.586419 s:  VX_ZONE_INIT:[tivxHostInitLocal:101] Initialization Done for HOST !!!
    Reading calmat file
    Test data path is NULL. Defaulting to current folder
    file read completed
    obj->num_views = 10
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    Test data path is NULL. Defaulting to current folder
    app_srv_fileio: Verifying graph 1  ... .
    app_srv_fileio: Verifying graph 1... Done
    [ 4940.062277] PVR_K:  2276: RGX Firmware image 'rgx.fw.22.104.208.318' loaded
    [ 4940.069296] PVR_K:(Error):  2267- 2276: RGXValidateFWHeaderVersion2: KM and FW version mismatch (expected: 23.1, found: 23.3) [112]
    [ 4940.081132] PVR_K:(Error):  2267- 2276: InitFirmware: RGXGetFWImageAllocSize failed [956]
    [ 4940.089317] PVR_K:(Error):  2267- 2276: RGXInit: InitFirmware failed (3) [1795]
    [ 4940.096613] PVR_K:(Error):  2267- 2276: RGXInit() failed (PVRSRV_ERROR_INVALID_PARAMS) in PVRSRVCommonDeviceInitialise() [2473]
    [ 4940.108086] PVR_K:(Error):  2267- 2276: PVRSRVDeviceFinalise() failed (PVRSRV_ERROR_NOT_INITIALISED) in PVRSRVCommonDeviceInitialise() [2487]
    [ 4940.120811] PVR_K:(Error):  2267- 2276: PVRSRVDeviceServicesOpen: Failed to initialise device (PVRSRV_ERROR_NOT_INITIALISED) [512]
    libEGL warning: egl: failed to create dri2 screen
    EGL: version 1.4
    EGL: GL Version = (null)
    EGL: GL Vendor = (null)
    EGL: GL Renderer = (null)
    EGL: GL Extensions = (null)
    filename = .//psdkra/srv/models/sedan_generic/sedan_generic.pod
    Couldn't load .pod file: sedan_generic.pod
    ERROR: Couldn't load any car model
    app_srv_fileio: Verifying graph 2  ... .
    app_srv_fileio: Verifying graph 2... Done
    app_srv_fileio: Running gr[ 4940.377860] audit: type=1701 audit(1651506928.836:25): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=2267 comm="vx_app_srv_file" exe="/opt/vision_apps/test_data/vx_app_srv_fileio.out" sig=11 res=1
    aph 1 ...
    app_srv_fileio: Running graph 1 ... Done
    app_srv_fil[ 4940.397485] audit: type=1334 audit(1651506928.856:26): prog-id=17 op=LOAD
    eio: Running graph 2 ...
    EGL: after eglCreateImageKHR() eglErro[ 4940.408588] audit: type=1334 audit(1651506928.856:27): prog-id=18 op=LOAD
    r (0x300c)
    EGL: ERROR: eglCreateImageKHR failed !!!
    EGL: ERROR: appEglWindowCreateIMG failed !!!
    EGL: after eglCreateImageKHR() eglError (0x300c)
    EGL: ERROR: eglCreateImageKHR failed !!!
    EGL: ERROR: appEglWindowCreateIMG failed !!!
    EGL: after eglCreateImageKHR() eglError (0x300c)
    EGL: ERROR: eglCreateImageKHR failed !!!
    EGL: ERROR: appEglWindowCreateIMG failed !!!
    EGL: after eglCreateImageKHR() eglError (0x300c)
    EGL: ERROR: eglCreateImageKHR failed !!!
    EGL: ERROR: appEglWindowCreateIMG failed !!!
    EGL: after eglCreateImageKHR() eglError (0x300c)
    EGL: ERROR: eglCreateImageKHR failed !!!
    EGL: ERROR: appEglWindowCreateIMG failed !!!
    root@j721e-evm:/opt/vision_apps/test_data#
    root@j721e-evm:/opt/vision_apps/test_data#
    root@j721e-evm:/opt/vision_apps/test_data#
    root@j721e-evm:/opt/vision_apps/test_data# ./vx_app_srv_ca --cfg app.cfg
    vx_app_srv_calibration.out  vx_app_srv_camera.out
    root@j721e-evm:/opt/vision_apps/test_data# ./vx_app_srv_camera.out --cfg app.cfg
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=5) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
      4990.254632 s: GTC Frequency = 200 MHz
    APP: Init ... Done ![ 4984.503285] audit: type=1701 audit(1651506972.960:30): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=2289 comm="vx_app_srv_came" exe="/opt/vision_apps/test_data/vx_app_srv_camera.out" sig=11 res=1
    !!
      4990.254717 s:  VX_ZONE_INIT:Enabled
      4990.254724 s:  VX_ZONE_ERROR:Enabled
      4990.254730 s:  VX_ZONE_WARNING:Enabled
      4990.255449 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] [ 4984.534865] audit: type=1334 audit(1651506972.992:31): prog-id=19 op=LOAD
    Added target MPU-0
      4990.255556 s:  VX_ZONE_INIT:[tivxPlatfor[ 4984.546221] audit: type=1334 audit(1651506972.992:32): prog-id=20 op=LOAD
    mCreateTargetId:116] Added target MPU-1
      4990.255643 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-2
      4990.255719 s:  VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-3
      4990.255728 s:  VX_ZONE_INIT:[tivxInitLocal:136] Initialization Done !!!
      4990.256148 s:  VX_ZONE_INIT:[tivxHostInitLocal:101] Initialization Done for HOST !!!
      4990.259333 s:  VX_ZONE_ERROR:[ownContextSendCmd:875] Command ack message returned failure cmd_status: -7
      4990.259357 s:  VX_ZONE_ERROR:[ownNodeKernelInit:590] Target kernel, TIVX_CMD_NODE_CREATE failed for node node_91
      4990.259363 s:  VX_ZONE_ERROR:[ownNodeKernelInit:591] Please be sure the target callbacks have been registered for this core
      4990.259370 s:  VX_ZONE_ERROR:[ownNodeKernelInit:592] If the target callbacks have been registered, please ensure no errors are occurring within the create callback of this kernel
      4990.259378 s:  VX_ZONE_ERROR:[ownGraphNodeKernelInit:608] kernel init for node 0, kernel com.ti.display ... failed !!!
      4990.259397 s:  VX_ZONE_ERROR:[vxVerifyGraph:2159] Node kernel init failed
      4990.259404 s:  VX_ZONE_ERROR:[vxVerifyGraph:2213] Graph verify failed
    GRPX: ERROR: Unable to verify graph for graphics !!!
      4990.259476 s: ISS: Enumerating sensors ... !!!
      4990.259665 s: ISS: ERROR: Enumerating sensors failed !!!
    appCreateImageSensor returned -1
      4990.260660 s: ISS: De-initializing sensor [(null)] ... !!!
    Segmentation fault (core dumped)
    root@j721e-evm:/opt/vision_apps/test_data# [ 4985.288277] audit: type=1334 audit(1651506973.748:33): prog-id=20 op=UNLOAD
    [ 4985.295247] audit: type=1334 audit(1651506973.748:34): prog-id=19 op=UNLOAD
  • Hi,

    Are you still facing this issue?

    Regards,

    Brijesh