This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PVRSRVWrapExtMemory error from eglCreateImageKHR call



Hi ,

I am working with DRA7xx-EVM. I need to do some image processing using both VPE and GPU.

When I try to pass the de-queued output buffer from VPE to GPUusing eglCreateImageKHR ,I am getting the following error:

PVR:(Error): PVRSRVWrapExtMemory: Error 1 returned [1629, /bridged_pvr_glue.c].

I have tried allocating output buffers for VPE with memory type set to both V4L2_MEMORY_DMABUF and V4L2_MEMORY_MMAP. In.In both case I was getting same the error.

I was able to pass the buffers directly to GPU when I was using glTexImage2D as the load function for GPU. But it was a very time consuming call. So I had to replace it with eglCreateImageKHR call. 

For debugging further I have created an omap buffer object in my local space and tried to memcpy the de-queued output buffer from VPE into that and pass it to eglCreateImageKHR  call. Surprisingly the load function was successful. The output buffers for VPE were also omap bo's set using V4L2_MEMORY_DMABUF

Can anybody explain me the difference between these 2 omap bo's ?

And why I am not able to load the buffer from VPE to GPU directly?

Any help would be greatly appreciated.

Sincerely,

Thushara Jayakumar.

  • Hello Thushara,

    I assume that your problem is caused by pvr driver. Because it is not properly installed.
    Try to rebuild pvr driver again and insmod the newly built driver.

    For more details refer to VIP driver guide - processors.wiki.ti.com/.../GLSDK_VIP_driver

    Best regards,
    Yanko
  • Hi Yanko.
    Thanks for the response.
    I have rebuild the driver again and tried. In fact I even moved on to latest GLSDK 7.0.
    I am still getting the same PVRSRVWrapExtMemory from the eglCreateImageKHR call.

    Regards
    Thushara.
  • Hello Thushara,

    I assume that your issue may cause by incorrect initialization of SGX driver.

    Try to rebuild separately from kernel, then insmod the new module.

    Rebuilding linux kernel with out of tree SGX module:
    In the recent DRA7xx GLSDK 6.02.01.02 there is a known issue when running graphics applications from the custom built kernel.
    When using a kernel built from the installer Makefile (make linux && make linux_install), pvrsrvinit will fail.
    There is an updated procedure available to fix this problem, please contact your local FAE for the detailed instructions to fix this issue.

    Take a look on this wiki - processors.wiki.ti.com/.../SGXDbg

    Best regards,
    Yanko
  • Hi Yonko,
    I am not using 6.02.01.02 , my GLSDK version is 7_00_00_04.
    For 7_00_00_04 if I am trying to build SGX module separately and installing, I am getting following error when doing insmod:


    [ 859.703350] ------------[ cut here ]------------
    [ 859.708210] WARNING: CPU: 0 PID: 2006 at fs/proc/generic.c:315 proc_register+0xb4/0x13c()
    [ 859.716816] proc_dir_entry '/proc/pvr' already registered
    [ 859.722502] Modules linked in: omapdrm_pvr(O+) xhci_hcd wl18xx(O) wlcore(O) mac80211(O) cfg80211(O) dwc3 wlcore_sdio(O) m25p80 compat(O) c_can_platform c_can can_dev btwilink dwc3_omap cryptodev(O) bluetooth 6lowpan_iphc [last unloaded: omapdrm_pvr]
    [ 859.745835] CPU: 0 PID: 2006 Comm: insmod Tainted: G O 3.14.31 #1
    [ 859.753168] Backtrace:
    [ 859.755752] [<c00120f0>] (dump_backtrace) from [<c001228c>] (show_stack+0x18/0x1c)
    [ 859.763715] r6:00000000 r5:ffffffff r4:00000000 r3:00000000
    [ 859.769720] [<c0012274>] (show_stack) from [<c0643dc8>] (dump_stack+0x7c/0xc8)
    [ 859.777307] [<c0643d4c>] (dump_stack) from [<c00461d0>] (warn_slowpath_common+0x70/0x94)
    [ 859.785807] r6:c0152d70 r5:00000009 r4:e92f1ca8 r3:e92f0000
    [ 859.791798] [<c0046160>] (warn_slowpath_common) from [<c0046298>] (warn_slowpath_fmt+0x38/0x40)
    [ 859.800933] r8:e94cc280 r7:c0980690 r6:ea6d2480 r5:ea6d24d1 r4:e94cc280
    [ 859.807993] [<c0046264>] (warn_slowpath_fmt) from [<c0152d70>] (proc_register+0xb4/0x13c)
    [ 859.816587] r3:c09806e1 r2:c080c970
    [ 859.820362] [<c0152cbc>] (proc_register) from [<c0152efc>] (proc_mkdir_data+0x4c/0x74)
    [ 859.828666] r10:c099efd8 r8:bf297de8 r7:00000005 r6:00000064 r5:00000000 r4:ea6d2480
    [ 859.836927] [<c0152eb0>] (proc_mkdir_data) from [<c0152f40>] (proc_mkdir+0x1c/0x20)
    [ 859.844965] r5:bf297e70 r4:bf2981e8
    [ 859.848776] [<c0152f24>] (proc_mkdir) from [<bf275cec>] (CreateProcEntries+0x1c/0x11c [omapdrm_pvr])
    [ 859.858432] [<bf275cd0>] (CreateProcEntries [omapdrm_pvr]) from [<bf2752ec>] (PVRCore_Init+0x28/0x114 [omapdrm_pvr])
    [ 859.869490] r5:bf297e70 r4:bf2981e8
    [ 859.873328] [<bf2752c4>] (PVRCore_Init [omapdrm_pvr]) from [<bf292b64>] (PVRSRVDrmLoad+0x18/0x50 [omapdrm_pvr])
    [ 859.883919] r6:00000064 r5:bf297e70 r4:bf2b8be8
    [ 859.888825] [<bf292b4c>] (PVRSRVDrmLoad [omapdrm_pvr]) from [<c03957a4>] (omap_drm_register_plugin+0x160/0x1b0)
    [ 859.899423] r5:bf297e70 r4:0000000d
    [ 859.903210] [<c0395644>] (omap_drm_register_plugin) from [<bf2c601c>] (PVRSRVDrmInit+0x1c/0x44 [omapdrm_pvr])
    [ 859.913619] r10:c009e3c0 r9:e92f0000 r8:bf2c6000 r7:e7a08400 r6:00000001 r5:bf297ddc
    [ 859.921881] r4:e92f1f48
    [ 859.924568] [<bf2c6000>] (PVRSRVDrmInit [omapdrm_pvr]) from [<c00089a8>] (do_one_initcall+0xf4/0x150)
    [ 859.934247] r6:00000001 r5:bf297e80 r4:e92f1f48 r3:00000000
    [ 859.940217] [<c00088b4>] (do_one_initcall) from [<c00a0ff0>] (load_module+0x17f0/0x1e24)
    [ 859.948696] r10:c009e3c0 r9:bf297e74 r8:00000001 r7:e7a08400 r6:00000001 r5:bf297e80
    [ 859.956956] r4:e92f1f48
    [ 859.959636] [<c009f800>] (load_module) from [<c00a1784>] (SyS_finit_module+0x6c/0x78)
    [ 859.967855] r10:00000000 r9:e92f0000 r8:c000ecc4 r7:0000017b r6:000243e8 r5:00000003
    [ 859.976116] r4:00000000
    [ 859.978776] [<c00a1718>] (SyS_finit_module) from [<c000eb40>] (ret_fast_syscall+0x0/0x30)
    [ 859.987367] r6:beab4bd4 r5:beab4d74 r4:00000000
    [ 859.992239] ---[ end trace 322470e996160868 ]---
    [ 859.997352] Error: Driver 'omapdrm_pvr' is already registered, aborting...


    After this lsmod shows module is inserted.

    if I do pvrsrvinit , I am getting following error:

    PVR:(Error): PVRSRVBridgeCall: Failed to access device. Function ID:3223086860 (Bad address). [294, /pvr_bridge_u.c]
    PVR:(Error): OpenServices: PVRSRVBridgeCall failed. [181, /pvr_bridge_u.c]
    PVR:(Error): PVRSRVInitSrvConnect: PVRSRVConnect failed [2572, /bridged_pvr_glue.c]
    PVR:(Error): SrvInit: PVRSRVInitSrvConnect failed (4) [37, /srvinit.c]
    PVR:(Error): main: SrvInit failed (4) [47, /pvrsrvinit.c]


    Regards
    Thushara.
  • Hello Thushara, 

    Do you use the following build sequence?

    Build and Install Instructions
    -------------------------------------------

    Setup the necessary environment variables. For details see the "INSTALL" file.

    Ensure that the Linux kernel has been built with CONFIG_PREEMPT=y

    Set the environment variables
    $ export ARCH=arm
    $ export CROSS_COMPILE=arm-linux-gnueabi-hf-
    $ export PATH=$PATH:<path to cross compiler toolchain>
    $ export KERNELDIR=<your kernel directory>
    $ export DISCIMAGE=<kernel module installation path>

    To build for OMAP5430/DRA7xx, change to the appropriate target directory:
    $ cd eurasia_km/eurasiacon/build/linux2/omap5430_linux

    Issue the make command:
    $ make

    The DDK software must be installed by the sudo user.
    $ sudo -E make kbuild_install

    Best regards,

    Yanko

  • Hi Yanko,

    I have followed exactly the same procedure for my build.
    Regards
    Thushara

  • Hi,

    Is there any update on this issue?

    I have also observed that multiple calls to eglCreateImageKHR is also resulting in PVRSRVWrapEXTMemory error. In my program I am reading from a file and displaying it. Initial calls were successful and I am getting proper output but after some time I am getting this error.

    Note: In my current application there is a memcpy involved from output of VPE to GPU. 

    Regards

    Thushara.

  • Hello Thushara,

    It seems your problem may cause by incorrect handle with services in your application.
    The command
    EGLImageKHR eglCreateImageKHR(
    EGLDisplay dpy,
    EGLContext ctx,
    EGLenum target,
    EGLClientBuffer buffer,
    const EGLint *attrib_list)

    is used to create an EGLImage from an existing image resource <buffer>.
    <dpy> specifies the EGL display used for this operation. <ctx> specifies the EGL client API context used for this operation, or EGL_NO_CONTEXT if a client API context is not required. <target> specifies the type of resource being used as the EGLImage source (examples include two-dimensional textures in OpenGL ES contexts and VGImage objects in OpenVG contexts). <buffer> is the name (or handle) of a resource to be used as the EGLImage source, cast into the type EGLClientBuffer. <attrib_list> is an list of attribute-value pairs which is used to select sub-sections of <buffer> for use as the EGLImage source, such as mipmap levels for OpenGL ES texture map resources, as well as behavioral options, such as whether to preserve pixel data during creation. If <attrib_list> is non-NULL, the last attribute specified in the list must be EGL_NONE.

    The resource specified by <dpy>, <ctx>, <target>, <buffer>, and
    <attrib_list> must not itself be an EGLImage sibling, or bound to an EGL
    PBuffer resource (eglBindTexImage, eglCreatePbufferFromClientBuffer).

    Values accepted for <target> are listed in Table aaa, below(fn1). (fn1) No values are defined by this extension. All functionality to create EGLImages from other types of resources, such as native pixmaps, GL textures, and VGImages, is layered in other extensions.

    Please see following example from GraphicsService.cpp: unbind the application from the window and release EGL resources when the application stops running:
    OpenGL contexts are lost frequently on applications (when leaving or going back to the home screen, when a call is received, when devices go to sleep, and so on). As a lost context becomes unusable, it is important to release resources as soon as possible.

    void GraphicsService::stop() {
    if (mDisplay != EGL_NO_DISPLAY) {
    eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

    if (mContext != EGL_NO_CONTEXT) {
    eglDestroyContext(mDisplay, mContext);
    mContext = EGL_NO_CONTEXT;
    }
    if (mSurface != EGL_NO_SURFACE) {
    eglDestroySurface(mDisplay, mSurface);
    mSurface = EGL_NO_SURFACE;
    }
    eglTerminate(mDisplay);
    mDisplay = EGL_NO_DISPLAY;
    }
    }

    Use destroy commands in your application after Initial calls.

    Best regards,
    Yanko
  • Hi Yanko,

    As discussed in this link e2e.ti.com/.../1555338 , I was able to fix issue caused by repetitive calls to eglCreateImageKHR.

    My current issue is the accessibility of VPE de -queued buffers in GPU load functions(eglCreateImageKHR)
    I am allocating VPE buffers with memory type set as V4L2_MEMORY_DMABUF . I am only able to load the contents through memcpy of VPE buffer contents to another locally created buffers.

    Regards
    Thushara.
  • I am having the same problem getting a VPE Dequeued buffer into the GPU without a memcpy. Did you solve this? Could you please let me know what you did? Thanks.