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.

At dm365, create jpeg encoder, occur Assignment of alg resources through RMAN FAILED

Hi all,

   When my create jpeg encoder, I get follow error. My jpeg parameter setting is:

...
pJPEGEnv->Params                   = Ienc1_Params_DEFAULT;
 pJPEGEnv->Params.maxWidth     = gm_stEncParams[0][0].uiWidth;
 pJPEGEnv->Params.maxHeight     = gm_stEncParams[0][0].uiHeight;
    pJPEGEnv->Params.forceChromaFormat = XDM_YUV_420P;

    pJPEGEnv->DynParams                   = Ienc1_DynamicParams_DEFAULT;
 pJPEGEnv->DynParams.inputWidth        = pJPEGEnv->Params.maxWidth;
 pJPEGEnv->DynParams.inputHeight       = pJPEGEnv->Params.maxHeight;
 pJPEGEnv->DynParams.captureWidth      = pJPEGEnv->Params.maxWidth;
 pJPEGEnv->DynParams.inputChromaFormat = XDM_YUV_420SP;

...

 

@20,815,942us: [+0 T:0x4b672490] ti.sdo.ce.image1.IMGENC1 - IMGENC1_create> Enter (engine=0x44c8d0, name='jpegenc', params=0x3d9224)
@20,816,142us: [+0 T:0x4b672490] CV - VISA_create(0x44c8d0, 'jpegenc', 0x3d9224, 0x700, 'ti.sdo.ce.image1.IIMGENC1')
@20,816,410us: [+0 T:0x4b672490] CV - VISA_create2(0x44c8d0, 'jpegenc', 0x3d9224, 0x18, 0x700, 'ti.sdo.ce.image1.IIMGENC1')
@20,816,620us: [+0 T:0x4b672490] ti.sdo.ce.alg.Algorithm - Algorithm_create> Enter(fxns=0x177458, idma3Fxns=0x0, iresFxns=0x17740c, params=0x3d9224, attrs=0x4b671c84)
@20,816,853us: [+0 T:0x4b672490] ti.sdo.ce.alg - ALG_create> Enter (scratchId=0, fxns=0x177458, parentAlg=0x0, params=0x3d9224)
@20,817,087us: [+2 T:0x4b672490] ti.sdo.ce.alg - ALG_create> algNumAlloc 5 memory recs
@20,817,259us: [+2 T:0x4b672490] ti.sdo.ce.alg - ALG_create> algAlloc returned numRecs=5
@20,817,403us: [+4 T:0x4b672490] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[0]: size=0xf54, align=0x80, space=0x11, attrs=0x1
@20,817,559us: [+4 T:0x4b672490] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[1]: size=0xc00, align=0x80, space=0x11, attrs=0x1
@20,817,706us: [+4 T:0x4b672490] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[2]: size=0xc400, align=0x80, space=0x11, attrs=0x1
@20,817,848us: [+4 T:0x4b672490] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[3]: size=0x968, align=0x80, space=0x11, attrs=0x1
@20,817,993us: [+4 T:0x4b672490] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[4]: size=0x64, align=0x80, space=0x11, attrs=0x1
@20,818,409us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(3924) = 0x49ca6000.
@20,818,634us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x49ca6000) = 0x871e5000.
@20,819,058us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(3072) = 0x49ca7000.
@20,819,286us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x49ca7000) = 0x871e4000.
@20,820,227us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(50176) = 0x4b673000.
@20,820,462us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b673000) = 0x863d5000.
@20,821,386us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(2408) = 0x4b6e3000.
@20,821,622us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b6e3000) = 0x871b1000.
@20,822,041us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(100) = 0x4b6e4000.
@20,822,276us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b6e4000) = 0x871b0000.
@20,823,087us: [+4 T:0x4b672490] ti.sdo.ce.alg - ALG_create> algInit returned IALG_EOK
@20,823,299us: [+0 T:0x4b672490] ti.sdo.ce.alg - ALG_create> Exit (algHandle=0x49ca6000)
@20,823,627us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(320) = 0x4b6e5000.
@20,823,886us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b6e5000) = 0x871af000.
@20,824,169us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Entered LockMP_acquire> lock[0x3dde58]
@20,824,389us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Leaving LockMP_acquire> lock[0x3dde58]
@20,824,571us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Entered LockMP_release>lock[0x3dde58]
@20,824,753us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Leaving LockMP_release>lock[0x3dde58]
@20,824,905us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Entered LockMP_acquire> lock[0x3dde58]
@20,825,061us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Leaving LockMP_acquire> lock[0x3dde58]
@20,825,428us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_alloc(344) = 0x4b6e6000.
@20,825,654us: [+4 T:0x4b672490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b6e6000) = 0x871ae000.
@20,826,096us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Entered LockMP_release>lock[0x3dde58]
@20,826,337us: [+0 T:0x4b672490] ti.sdo.ce.osal.LockMP - Leaving LockMP_release>lock[0x3dde58]
@20,826,676us: [+7 T:0x4b672490] ti.sdo.ce.alg.Algorithm - Algorithm_create> Assignment of alg resources through RMAN FAILED (0x7)
@21,159,523us: [+0 T:0x4b672490] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Enter(alg=0x44c9f0)
@21,160,725us: [+0 T:0x4b672490] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Exit
@21,160,926us: [+0 T:0x4b672490] ti.sdo.ce.alg.Algorithm - Algorithm_create> return (0x0)
@21,161,072us: [+2 T:0x4b672490] CV - VISA_create2> FAILED to create local codec.
@21,161,213us: [+0 T:0x4b672490] CV - VISA_delete(0x44c9b8)
@21,161,407us: [+5 T:0x4b672490] CV - VISA_delete> deleting codec (localQueue=0xffff, remoteQueue=0xffff)
@21,161,583us: [+0 T:0x4b672490] ti.sdo.ce.image1.IMGENC1 - IMGENC_create> return (0x0)

Best Regards

Tanyu

  • Hi,

    Please verify if you have any other codec using the same resources in a separate scratch group id? Also, please check the available CMEM for the codec and application. If required, you can share your codec engine .cfg file with us so that we can look into it and provide help.

    Please do tell us the version number of all the codecs that you are currently using simultaneously in your application and also tell us the flow of codec creation/execution that you are doing in your app.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Hi, Anshuman

    Yes, I use same resources in a separate scratch group id.  result in error is follow .cfg configuration:
    ...

    var H264ENC = xdc.useModule('ti.sdo.codecs.h264enc.ce.H264ENC');
    var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC')

    var myEngine = Engine.create("encode", [

        {name: "h264enc", mod: H264ENC, local: true, groupId: 1},
        {name: "jpegenc", mod: JPEGENC, local: true, groupId: 2},
    ]);

    ...

    if I change above configuration to:

    var myEngine = Engine.create("encode", [

        {name: "h264enc", mod: H264ENC, local: true, groupId: 1},
        {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},
    ]);

    It is ok.

    I setting H264 and JPEG codec to separate groupId is according to "Encode H.264 and JPEG concurrently" http://e2e.ti.com/support/embedded/f/356/p/40743/141964.aspx#141964 post.

    Why result this error? Have same doc to explain how to wrrite ./cfg file. I want to know more detail for it.

    Best Regards

    tanyu

  • FWIW, there are some details on Group Ids here:

    http://processors.wiki.ti.com/index.php/Codec_Engine_GroupIds

    If you place the codecs in the same group, they will share resources (and therefore require fewer of them).  If you place them in separate groups, you'll require more resources (but they can pre-empt each other).

    Chris

  • Hi,

    So you are using different scratch group ids and that is why the problem is coming. You have to tell me the version of H.264 encoder and JPEG encoder that you are using. I feel you might be running out of resources in EDMA channels. As they are in different scratch group id, EDMA channels will not be shared and on DM36x we are limited to 64 EDMA channels.

    I would recommend you to free up any EDMA channels you are using in your system. If you are not allocating any channels in your system (app), then you might want to reduce the channels in the kernel. There is a file called edma.h in the kernel tree that decides the number of channels kernel wants to block for drivers, although it might not be using all those channels/drivers.

    Chris' post and the wiki page are really useful reading material to understand the scratch group Id concept.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Hi,  Anshuman

          I use H264 encoder  of 02.00.00.09 version and JPEG encoder ver01100008 of version.  The .cgf file modified accroding to h264 codec integration guide, e.g setting EDMA maxReuqests to 128 and enable MEMTCM etc..; Thus, I thinks may be isn't EDMA resources enought. Follow is full content of this file.

    /*  ============================================================================
     *   Copyright (c)  Texas Instruments Incorporated 2009
     *
     *   Use of this software is controlled by the terms and conditions found in the
     *   license agreement under which this software has been supplied or provided.
     *  ============================================================================
     */
    /* Load support for the Codec Engine OSAL */
    var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
    osalGlobal.runtimeEnv = osalGlobal.LINUX;

    /* Load support for the 'Davinci Multimedia Application Interface' module */
    var DMAI = xdc.loadPackage('ti.sdo.dmai');

    /* Load support for SimpleWidget */
    var SW = xdc.loadPackage('ti.sdo.simplewidget');

    environment['xdc.cfg.check.fatal'] = 'false';

    var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');
    RMAN.useDSKT2 = false;
    RMAN.persistentAllocFxn = "__ALG_allocMemory";
    RMAN.persistentFreeFxn = "__ALG_freeMemory";
    RMAN.semCreateFxn = "Sem_create";
    RMAN.semDeleteFxn = "Sem_delete";
    RMAN.semPendFxn = "Sem_pend";
    RMAN.semPostFxn = "Sem_post";
    RMAN.tableSize = 10;

    var EDMA3 = xdc.useModule('ti.sdo.fc.edma3.Settings');

    var vicp = xdc.useModule('ti.sdo.linuxutils.vicp.VICP');

    var HDVICP = xdc.useModule('ti.sdo.fc.ires.hdvicp.HDVICP');

    var VICP = xdc.useModule('ti.sdo.fc.ires.vicp.VICP2');

    var VICPSYNC = xdc.useModule('ti.sdo.fc.vicpsync.VICPSYNC');

    var HDVICPSYNC = xdc.useModule('ti.sdo.fc.hdvicpsync.HDVICPSYNC');

    var VICP = xdc.useModule('ti.sdo.fc.memutils.MEMUTILS');

    DDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');

    var EDMA3CHAN = xdc.useModule('ti.sdo.fc.ires.edma3chan.EDMA3CHAN');

    var LSP = xdc.useModule('ti.sdo.linuxutils.edma.EDMA');

    var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');

    var MEMTCM = xdc.useModule('ti.sdo.fc.ires.memtcm.MEMTCM');
    MEMTCM.cmemBlockId = 1;

    EDMA3.globalInit = true;
    EDMA3.maxQdmaChannels = [10,10,10,10];
    EDMA3.maxRequests = 128;

    xdc.loadPackage("ti.sdo.ce.video2");
    xdc.loadPackage("ti.sdo.fc.hdvicpsync");

    /*
     *  ======== Engine Configuration ========
     */
    var H264ENC = xdc.useModule('ti.sdo.codecs.h264enc.ce.H264ENC');
    var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC');

    var Engine = xdc.useModule('ti.sdo.ce.Engine');

    var myEngine = Engine.create("encode", [

        {name: "h264enc", mod: H264ENC, local: true, groupId: 1},
        {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},
    ]);


    xdc.loadPackage('ti.sdo.fc.ires.vicp').profile = "debug_trace";
    xdc.loadPackage('ti.sdo.fc.ires.edma3chan').profile = "debug_trace";
    xdc.loadPackage('ti.sdo.fc.rman').profile = "debug_trace";
    xdc.loadPackage('ti.sdo.fc.edma3').profile = "debug_trace";

    Program.main = null

    Reagrds,

    tanyu

     

  • Hi,

        I have view framework components source code, find error code '0x07' is " Error, resource unavailable" and this resource may be is HDVICP. From bebug output I find HDVICP is owned by H264 codec when call 'RMAN_assignResources()' and the resman->getHandle(alg, resDesc[n].protocolArgs, scratchGroupId, &status) fun's return status indicate error code. Otherwise, I think whether I haven't correct mutex when access HDVICP resource by mutil-codec instance, becase  at .cfg file's

    ...

    RMAN.semCreateFxn = "Sem_create";
    RMAN.semDeleteFxn = "Sem_delete";
    RMAN.semPendFxn = "Sem_pend";
    RMAN.semPostFxn = "Sem_post"

    ...

    the "Sem_create" etc.. fun at our app isn't implemetion.

    Follow I past my debug output relate create JPEG codec error:

    ... [above is ok]
    @55,473,889us: [+0 T:0x4b572490] ti.sdo.fc.rman - RMAN_assignResources> Enter (alg=0x49ba6000, resFxns=0x189f00, scratchGroupId=2)
    @55,474,247us: [+4 T:0x4b572490] OM - Memory_contigAlloc> CMEM_alloc(320) = 0x4b5e5000.
    @55,474,467us: [+4 T:0x4b572490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b5e5000) = 0x871af000.
    @55,474,756us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Entered LockMP_acquire> lock[0x3f0e80]
    @55,474,971us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Leaving LockMP_acquire> lock[0x3f0e80]
    @55,475,141us: [+0 T:0x4b572490] ti.sdo.fc.ires.hdvicp - IRESMAN_HDVICP_getProtocolName> Enter
    @55,475,334us: [+0 T:0x4b572490] ti.sdo.fc.ires.hdvicp - IRES_HDVICP_getName> Enter
    @55,475,476us: [+0 T:0x4b572490] ti.sdo.fc.ires.hdvicp - IRES_HDVICP_getName> Exit (Name=ti.sdo.fc.ires.hdvicp)
    @55,475,615us: [+0 T:0x4b572490] ti.sdo.fc.ires.hdvicp - IRESMAN_HDVICP_getProtocolName> Exit (name=ti.sdo.fc.ires.hdvicp)
    @55,475,756us: [+0 T:0x4b572490] ti.sdo.fc.ires.hdvicp - IRES_HDVICP_getName> Enter
    @55,475,912us: [+0 T:0x4b572490] ti.sdo.fc.ires.hdvicp - IRES_HDVICP_getName> Exit (Name=ti.sdo.fc.ires.hdvicp)
    @55,476,075us: [+0 T:0x4b572490] ti.sdo.fc.ires.vicp2 - IRESMAN_VICP2_getProtocolName> Enter
    @55,476,221us: [+0 T:0x4b572490] ti.sdo.fc.ires.vicp2 - IRESMAN_VICP2_getProtocolName> Exit (name=ti.sdo.fc.ires.vicp2)
    @55,476,368us: [+0 T:0x4b572490] ti.sdo.fc.ires.vicp2 - IRESMAN_VICP2_getProtocolRevision> Enter
    @55,808,118us: [+0 T:0x4b572490] ti.sdo.fc.ires.vicp2 - IRESMAN_VICP2_getProtocolRevision> Exit (version=(1.0.0))
    @55,808,335us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Entered LockMP_release>lock[0x3f0e80]
    @55,808,603us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Leaving LockMP_release>lock[0x3f0e80]
    @55,808,769us: [+2 T:0x4b572490] ti.sdo.fc.rman - RMAN_assignResources> Call getHandle on the IRESMAN implementation 0x18aab8
    @55,808,920us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Entered LockMP_acquire> lock[0x3f0e80]
    @55,809,086us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Leaving LockMP_acquire> lock[0x3f0e80]
    Start init osd dot location!
    @55,809,822us: [+4 T:0x4b572490] OM - Memory_contigAlloc> CMEM_alloc(344) = 0x4b5e6000.
    @55,810,066us: [+4 T:0x4b572490] OM - Memory_contigAlloc> CMEM_getPhys(0x4b5e6000) = 0x871ae000.
    @55,824,761us: [+0 T:0x486f6490] ti.sdo.ce.video1.VIDENC1 - VIDENC1_process> Enter (handle=0x45f0f0, inBufs=0x486f5918, outBufs=0x486f590c, inArgs=0x486f58fc, outArgs=0x486f5884) [H264 codec process thread]
    @55,825,024us: [+5 T:0x486f6490] CV - VISA_enter(visa=0x45f0f0): algHandle = 0x45e810
    @55,825,186us: [+0 T:0x486f6490] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Enter(alg=0x45e810)
    @55,825,372us: [+0 T:0x486f6490] ti.sdo.fc.rman - RMAN_activateAllResources> Enter (alg=0x47ef4000, resFxns=0x18a8d8, scratchGroupId=1)
    @55,825,609us: [+0 T:0x486f6490] ti.sdo.fc.rman - RMAN_activateAllResources> Exit (status=0)
    @55,825,752us: [+0 T:0x486f6490] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Exit
    @55,828,828us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Entered LockMP_release>lock[0x3f0e80]
    @55,829,116us: [+0 T:0x4b572490] ti.sdo.ce.osal.LockMP - Leaving LockMP_release>lock[0x3f0e80]
    @55,829,669us: [+0 T:0x4b572490] ti.sdo.fc.rman - RMAN_assignResources> Exit (status=7)
    @55,830,092us: [+7 T:0x4b572490] ti.sdo.ce.alg.Algorithm - Algorithm_create> Assignment of alg resources through RMAN FAILED (0x7)
    @55,830,341us: [+0 T:0x4b572490] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Enter(alg=0x45fc48)
    @55,831,742us: [+0 T:0x4b572490] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Exit
    @55,831,978us: [+0 T:0x4b572490] ti.sdo.ce.alg.Algorithm - Algorithm_create> return (0x0)
    @55,832,378us: [+2 T:0x4b572490] CV - VISA_create2> FAILED to create local codec.

    Best Regards

    Tanyu

  • Hi,

    Does it make a difference if you change the order of H.264 and JPEG creation?

    Also, in the above log, are you showing that JPEG encode creation failed while H.264 process was getting called? I would recommend creating both the codecs first and then try running process calls, to see if everything in the system is working or not.

    Regards,

    Anshuman

  • Hi,

    I have changed the order of H.264 and JPEG creation and synchronized between H.264 and JPEG creation, thus after both created, the process will called. But the error of my posted is still.

    Throught I read H.264 codec released note, I find this notes "The codec uses MJCP memory as scratch buffers and hence there is restriction on the usage of MJCP
    concurrently".  It's mean can't run concurrently h264 and JPEG encoder at dm365? Because JPEG encoder need MJCP resource.

    Best Regards,

    Tanyu

  • Hi,

    There are some buffers that belong to MJCP, are used in H.264 encoder. If you want to free up those resources, you would have to set enableDDR to 1 in H.264 configuration parameters.

    BTW, even after that, if you are using ver 2.00.00.09 version of H.264 codec, the EDMA channels would be limited, not allowing you to run JPEG in parallel with H.264. You can use the encodingPreset = XDM_USER_DEFINED and encQualit=2. This will need lesser EDMA channels but would be a compromise in performance. You can do a tradeoff based on your requirements.

    You might want to refer to http://processors.wiki.ti.com/index.php/Migration/Integration_Guide_for_DM36x_H.264_version_2.x_codecs and other links on this page to get more details about the codecs.

     

    Regards,

    anshuman

    PS: Please mark the post as verified, if you think it has answered your question. Thanks.