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.

CMEM error in dm365 decode and encode

My encode programm can run correctly when configure the cmem like below:

#cmem:48m linux:80m

insmod cmemk.ko phys_start=0x85000000 phys_end=0x88000000 pools=128x56,20x1382400,1x6785280,1x3112704,4x921600,5x49152 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672

The CMEM loadmodule information:

ioremap_nocache(0x85000000, 50331648)=0xc6000000
allocated heap buffer 0xc6000000 of size 0x7e7000
cmem initialized 6 pools between 0x85000000 and 0x88000000
CMEM Range Overlaps Kernel Physical - allowing overlap
CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x85000000)
ioremap_nocache(0x1000, 28672)=0xc5990000
no remaining memory for heap, no heap created for memory block 1                       (What it  means ?????)
cmem initialized 1 pools between 0x1000 and 0x8000
IRQK module: built on Jul 20 2009 at 22:32:57


I want to add the decode programm into the encode programm , which means my whole programm can decode and encode separately. But 
when the function : hDecode = VIDDEC2_create(hEngine, codecName, params) is called , the cmem is error:

CMEMK Error: ioctl: failed to allocate heap buffer of size 0x8c0150
CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAPCACHED failed: -1

It's seems that i don't have enough memory for allocate buffer ,so i change the configuration like :

#cmem:60m linux:68m

insmod cmemk.ko phys_start=0x84400000 phys_end=0x88000000 pools=128x56,20x1382400,1x6785280,1x3112704,4x921600,5x49152,1x9175376 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672

#0x8c0150=9175376


The CMEM loadmodule information:

ioremap_nocache(0x84400000, 62914560)=0xc5000000
allocated heap buffer 0xc5000000 of size 0xb26000
cmem initialized 7 pools between 0x84400000 and 0x88000000
CMEM Range Overlaps Kernel Physical - allowing overlap
CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x84400000)
ioremap_nocache(0x1000, 28672)=0xc4990000
no remaining memory for heap, no heap created for memory block 1
cmem initialized 1 pools between 0x1000 and 0x8000
IRQK module: built on Jul 20 2009 at 22:32:57

But the error still exist, so i need your help . Any advice will be appreciate.

Best regards.

Katee

  • Hi Katee,

    Which encoder and decoder are you using? Are these codecs that came bundled in DVSDK 3.10? If so, the encodedecode demo also instantiate both an encoder and a decoder at the same time. You may want to take a look there to see how it's done.

    If you are working with codecs other than the ones that are provided in the DVSDK (or if you have to configure them differently due to some feature you are trying to support), your CMEM memory requirements are going to vary. Your CMEM configuration is defining two memory blocks, block 0 that ranges from 0x85000000-0x88000000 and block 1 from 0x1000-0x8000. Block 1 is internal TCM memory from the ARM - there is a discussion of this on http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/t/7930.aspx. I think you can safely ignore the message

    no remaining memory for heap, no heap created for memory block 1

    since that is expected, given you are allocating all memory in the block to a buffer of size 28672. There is no space for a heap (nor would the heap be large enough to hold 9175376 bytes if we created one, which is what the decoder seems to be requesting.)

    You are already using the right techniques to create a bigger heap on block 0: one is to reduce the number of buffers allocated into the pools giving more to the heap, the other is to reduce the amount of memory allocated for Linux (ie. change the mem= option in your uboot bootargs), and then change the size of block 0 by setting the appropriate start address in parameter phys_start=. If the problem persists, you may wish to enable debug version of CMEM and get the CMEM trace dump (see http://wiki.davincidsp.com/index.php?title=CMEM_Overview#Debugging_Techniques). Maybe we'll see something there that would be of use.

    Best regards,

    Vincent

  • Hi,Vincent,

    Thank u so much for your help.

     I am using dvsdk_2_10_01_18 for my encoder and decoder . Like i said ,  i change the cmem configuration like :


    insmod cmemk.ko phys_start=0x84400000 phys_end=0x88000000 pools=128x56,20x1382400,1x6785280,1x3112704,4x921600,5x49152,1x9175376 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672

    #0x8c0150=9175376

    The error still exist

    CMEMK Error: ioctl: failed to allocate heap buffer of size 0x8c0150
    CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAPCACHED failed: -1

     So, I change the cmem configuration  again ,after i delete the last pool "1x9175376 ", the cmem error is not exist.

    But the function : hDecode = VIDDEC2_create(hEngine, codecName, params) recv sigmentation fault .

    The hEngine is a Engine Handle which came from the function Engine_open("encdec",NULL,NULL);  My config file is :

    ........

    var H264DEC  = xdc.useModule('ti.sdo.codecs.h264dec.ce.H264DEC');

    var Engine = xdc.useModule('ti.sdo.ce.Engine');
    var myEngine = Engine.create("encdec", [
        {name: "mpeg4enc", mod: MPEG4ENC, local: true, groupId: 1},
        {name: "h264enc", mod: H264ENC, local: true, groupId: 1},
        {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},
        {name: "h264dec", mod: H264DEC, local: true, groupId: 1},
        {name: "g711enc", mod: G711ENC, local: true},
        {name: "g711dec", mod: G711DEC, local: true},
    /*    {name: "aec", mod: AEC,local: true}, */
    ]);

    ..........

    The codecName is  "h264dec" .

    The params is (VIDDEC2_Params*)&extnParams:

    params->maxFrameRate = 30000;
    params->maxWidth = 720;
    params->maxHeight = 480;
     params->forceChromaFormat = XDM_YUV_420SP;
       
    extnParams.displayDelay = 0; 
    extnParams.hdvicpHandle = (void*) NULL;
    // extnParams.resetHDVICPeveryFrame = 0;
    extnParams.disableHDVICPeveryFrame = 1;

    params->size = sizeof(IH264VDEC_Params);

    extnParams.viddecParams = *params;

    In conclusion , I have no idea about the sigmentation fault . I don't known which step is wrong and how to debug . Pls give me some advice , Thank u so much .

    Best regards,

    Katee

     


     

  • Glad you have resolved the CMEM memory issue. The segmentation fault could be due to wrong params being passed to the decoder/encoder. Are you using TI's h264 codecs or your own? You referred to them as "my encoder and decoder", yet the module name is "ti.sdo.codecs.h264dec.ce.H264DEC", which seems to indicate you are using TI's codecs. In the latter case, I'd suggest you double-check your parameters to ensure they are correct (compare them with the ones in the original demos to see what you are doing differently). If you are unsure whether your parameters are supported, refer to the codecs' documentation. There are also folks on the codecs forum that may be able to better assist you.

    If you are writing your own codecs, then you will need to step through your code to see what went wrong. A good debug trick to better pinpoint the segmentation fault is by using CE_DEBUG=2 to get a trace from Codec Engine (see http://processors.wiki.ti.com/index.php/CE_DEBUG).

    Best regards,

    Vincent

  • Thanks again for your patient help. I have resolved the segmentation fault . It was my mistake that missed  the important initialization : Dmai_init .

    All your advice are very meaningful  for me . Thanks !

    Best regards,

    Katee

  • Hi

         I am trying to test the dspsamples loopgpp and loop.out files.

    but getting IllegalInstructions.i haveinitialised the cmem.ko as well dsplinkk.ko too

    any one can share their exp. in this

    Sayiram K N