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.

memory contention when using EDMA on A8 side with OMX chain that contains VLPB on DSP

Hi,

I am working on TI8168 with EZSDK 5.05, i have built an EDMA driver based on the edma example on

<ezsdk>/example-applications/linux-driver-examples-psp04.04.00.01/edma/

When i am using the EDMA driver for data transfers with in an OMX chain that contains capture->dei->display the edma transfers data OK.
When i am adding to the OMX chain a VLPB on DSP as follows: capture->VLPB->dei->display, data transfers become corrupted. I suspect that there is some kind of memory contention between the VLPB and the EDMA, has anyone faced a similar problem? what may cause such a problem?

Another thing is that when in first OMX chain that doesn't contain VLPB i am using allocation of memory in shared region 2 using

heap = SharedRegion_getHeap(IL_CLIENT_SR); 
Image = Memory_alloc(heap, ((3*HD_WIDTH*HD_HEIGHT)>>1), 128, NULL); 

memory is allocated.

When i am using the same code for allocation of memory in second OMX chain that contain VLPB i get segmentation fault for this allocation which also makes me believe that the VLPB is causing memory contention.

Gabi

  • Hi,

    1. make sure that your EDMA transfers are configured with source and destination addresses are physically contiguous memory regions.

    2. the source or destination memory used in EDMA transfers need to be made cache coherent if you are also accessing (via CPU reads or writes)  the same memory. If you modified 'source' memory region, prior to issuing the DMA transfer make sure you cache-writeback the range before initiating DMA transfer. Similarly, cache-invalidate the 'destination' memory following a DMA transfer before accessing it via CPU. 

    3. The source and destination memory buffers should be allocated with cache-line size alignment *and* in should be a length that is a multiple of cache-line size. (128)

    For the Memory allocation issue, it looks like the heap that is used is getting corrupted before the second chain tries issues Memory_alloc(). This could be related to EDMA cache coherency or some other memory corruption that issued stray writes to the heap area.

    These are just general guidelines you may want to double check, otherwise there isn't enough information to tell what's going on.

    Good luck,
    Murat  

  • Hi Murat,

    Thanks for your respond.

    raormanrat said:
    1. make sure that your EDMA transfers are configured with source and destination addresses are physically contiguous memory regions.

    Verified, i am using buffers allocated by OMX components in shared region 2 which are physically contiguous.

    raormanrat said:
    2. the source or destination memory used in EDMA transfers need to be made cache coherent if you are also accessing (via CPU reads or writes)  the same memory. If you modified 'source' memory region, prior to issuing the DMA transfer make sure you cache-writeback the range before initiating DMA transfer. Similarly, cache-invalidate the 'destination' memory following a DMA transfer before accessing it via CPU. 

    Shared region 2 is not cachable as far as i know and i am not using CPU read or writes thus i don't care about cache coherence

    raormanrat said:
    3. The source and destination memory buffers should be allocated with cache-line size alignment *and* in should be a length that is a multiple of cache-line size. (128)

    Done.

    raormanrat said:
    For the Memory allocation issue, it looks like the heap that is used is getting corrupted before the second chain tries issues Memory_alloc(). This could be related to EDMA cache coherency or some other memory corruption that issued stray writes to the heap area.

    This problem is not related to EDMA, what i was saying is that when using the same method for memory allocation as in decode_mosaicdisplay example

    heap = SharedRegion_getHeap(IL_CLIENT_SR);
    pBuffer = Memory_alloc (heap, pAppData->decILComp[i]->outPortParams->nBufferSize, 128, NULL);

    In a OMX chain that contains VLPB on DSP the call for  pBuffer = Memory_alloc (heap, pAppData->decILComp[i]->outPortParams->nBufferSize, 128, NULL); causes segmentation fault regardless of EDMA usage. which leads me to think that the problems are related to memory contention.

    raormanrat said:
    These are just general guidelines you may want to double check, otherwise there isn't enough information to tell what's going on.

    What other information is required? please guide me and i will supply it.

    Gabi

  • Hi,

    Just some additional sanity checks:

    1. during the second allocation attempt from the IL_CLIENT_SR heap, are you obtaining a valid 'heap' from the SharedRegion_getHeap() call?

    2. If you perform any Memory_free() operations, can you make sure you are free'ing correct size with respect to what was allocated?

    3. Can you make sure that there is no issue evaluating the second argument you pass to the Memory_alloc() call is valid. For example, can you print and verify the 'pAppData->decILComp[i]->outPortParams->nBufferSize' before you call the Memory_alloc() function?

    Murat

  • Hi Murat,

    Thanks for your answer.

    raormanrat said:
    1. during the second allocation attempt from the IL_CLIENT_SR heap, are you obtaining a valid 'heap' from the SharedRegion_getHeap() call?

    I am trying to allocate memory from heap only once and i receive a segmentation fault, i receive a non zero value of heap 0x111258.

    raormanrat said:
    2. If you perform any Memory_free() operations, can you make sure you are free'ing correct size with respect to what was allocated?

    I can't free any memory because there is a segmentation fault right after the Memory_alloc().

    raormanrat said:
    3. Can you make sure that there is no issue evaluating the second argument you pass to the Memory_alloc() call is valid. For example, can you print and verify the 'pAppData->decILComp[i]->outPortParams->nBufferSize' before you call the Memory_alloc() function?

    The second value is 3110400 which is (3*1920*1080)/2 and there is enough memory space in shared region 2.

    If you need any more information, please ask.

    Gabi