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.

Facing error in capture encode demo for Netraboard

I am using ezsdk_dm816x-evm_5_02_02_60_setuplinux Netra package with omx-ti816x-src_05_02_00_15 
and linux-2.6.37-psp04.00.00.12.
I am working on File in File out of capture_encode demo.
I am using shared region address 0xb3d00000 and I am allocating 4 input and 4 output buffers 
through omx_usebuffer .
After reading from file it is hanging in different places in between omx_emptythisbuffer
and omx_fillbufferdone. It is behaving randomly.
If I allocate buffers through omx_allocatebuffer then the same code base is working fine and 
.h264 file is getting generated.


For my scenario I have to use omx_usebuffer. If there is any known issue please let me know.
Thanks in advance,

Vaishnavi
  • Vaishnavi,

    For OMX_UseBuffer, from where are you allocating the buffer. Please note OMX componnet can work only with Shared region allocated buffers. So When you pass the address you have to givi shared region pointers, which It will transalate to physical address and use it. Which API you are using to allocate buffer. DOMX (check domx_delegate file / and adress traslation in DOMX) would do address traslation. It appears addrress is not correct and linux will give unpredictable behavior as result of memory corruption,

    Regards

    Vimal

  • Hi Vimal,

    I am using 0xb3d00000 address which is mentioned as Shared Region between Host and MC-HDVICP2 and MC-HDVPSS,

     used to allocate all video buffers (IPC_SR_FRAME_BUFFERS) in memory map.

    I crosschecked it by keeping dumps on m3 side and got the 0xb3d00000 address when I allocate buffers using omx_allocatebuffer.

    So I used same address for omx_usebuffer.

    buffers are getting allocated and I am able to read data in to the buffers from the .yuv file.

    I am using like this:

    for (i = 0; i < pAppData->encILComp->inPortParams->nBufferCountActual; i++)
    {

      pBuffInput[i] = allocate_shared_memory(pAppData->encILComp->inPortParams->nBufferSize);
      printf("pBuffInput is %p",pBuffInput[i]);
     if(NULL == pBuffInput[i])
     {
      printf("Not able to allocate input memory! \n");
      return 0;
     }

     pBuffInPhy[i] = get_dsp_address(pBuffInput[i]);
     printf("pBuffInPhy[%d] is %d \t  %p\n",i,pBuffInPhy);

    }

    for (i = 0; i < pAppData->encILComp->inPortParams->nBufferCountActual; i++)
      {
     eError = OMX_UseBuffer(pAppData->pEncHandle,
                                     &pAppData->encILComp->inPortParams->pInBuff[i],
                                     OMX_VIDENC_INPUT_PORT,
                                     pAppData->encILComp,
                                     pAppData->encILComp->inPortParams->nBufferSize,
                                       pBuffInPhy[i]);

           if (eError != OMX_ErrorNone)
           {
                  printf ("Error in OMX_useBuffer()- Input Port State set : %s \n",
                         IL_ClientErrorToStr (eError));
                  goto EXIT;
           }
      }

     

    please suggest me if there is anything to check.

    Regards,

    Vaishnavi.

     

  • Vaishnavi,

    For OMX_Usebuffer you can not use physical buffer. It has to be SR pointer. You can check, when you do alloc buffer, you do't get physical address. You get vertual address, which is translated to SR in DOMX A8 side, and on M3 SR to physical address translation happens. So If you pass physical address, this translation will go wrong. Also when you allocate buffers for physical address, how do shared region know that someone is allocating buffers from it. It has to be allocated from shared region through Memory_alloc apis and not malloc / or phisycal alloc.

    Regards

    Vimal

  • Hi Vimal,

    I am  using mmap to allocate buffers.I will get arm virtual ptr.

    I am conerting this arm virtual pointer to dsp vistual ptr using below function:

    char *get_dsp_address(char *arm_virtual_ptr )
    {
       unsigned int arm_base_addr;
       unsigned int dsp_base_addr;
       char * dsp_virt_ptr = NULL;

       if((char*)shared_buff_info.virt_base != NULL)
       {
          arm_base_addr = shared_buff_info.virt_base;
          dsp_base_addr = shared_buff_info.phy_base;
          dsp_virt_ptr = (char*) (((unsigned int)arm_virtual_ptr-arm_base_addr) + dsp_base_addr);

          printf("arm_virt_ptr: 0x%8.8x\n", arm_virtual_ptr);
          printf("dsp_virt_ptr: 0x%8.8x\n", dsp_virt_ptr);
       }
       else
       {
          printf("Setup the shared memory first!!!\n");
       }
    printf("get_dsp_address is done and dsp_virt_ptr : 0x%8.8x\n", dsp_virt_ptr);
       return (char*)dsp_virt_ptr;
    }

    This dsp_virt_ptr I am using as SR ptr and passing in omx_usebuffer

    In the same manner I am again convertnig back pbuffer->pbuffer to arm address using get_arm_address()  and

    then I am using in ilclient while fread and fwrite

    char *get_arm_address(char *dsp_phy_ptr )
    {

       unsigned int arm_base_addr;
       unsigned int dsp_base_addr;
       char * arm_virt_ptr = NULL;

       if((char*)shared_buff_info.virt_base != NULL)
       {
          arm_base_addr = shared_buff_info.virt_base;
          dsp_base_addr = shared_buff_info.phy_base;
          arm_virt_ptr = (char*) (((unsigned int)dsp_phy_ptr-dsp_base_addr) + arm_base_addr);

           }
       else
       {
          printf("Setup the shared memory first!!!\n");
       }

       return (char*)arm_virt_ptr;
    }

    I have done same thing in omx_05_00_00_11 package for vc3 demo(decoder) and tested on Netra board itself. It is working fine.
    Please suggest me if there is anything to check.

    Thanks in advance,

    Vaishnavi

     

     

     

  • Vaishanavi,

    With 5.11 package, we did not had non tunnel support, so usebuffer/allocbuffer was not supported.

    For allocating buffers

    srHeap = SharedRegion_getHeap(region); //region is 2 in ezsdk

    virtAddr = (UInt32)Memory_alloc((IHeap_Handle)srHeap , nbytes, 0, NULL);

    char *srPtr = (char*) SharedRegion_getSRPtr ((Ptr) virtAddr, region);

    This SR ptr should be given to omx_usebuffer call.

    Regards

    Vimal

  • Vaishnavi,

    In the earlier post I quotes as SR ptr to be used, that is actually porting poinetr. on linux virtAddr should be used for OMX_Usebuffer. DOMX will translate this to SR and give it to M3.

    Regards

    Vimal