Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

TDA2SX: How to use shared memory in other process

$
0
0

Part Number: TDA2SX

Hello,

We use OSA_memAllocSR function to allocate shared memory, In the other process we use physical address:get from function OSA_memVirt2Phys,but it will report  "Segmentation fault".

1. One process in A15 allocate SR1 memory, code below:

for (id = 0; id < pOutObj->numFrames; id++)
    {

        UInt32 imgSize = pObj->outChnInfo.pitch[0]*pObj->outChnInfo.height;
        System_Buffer *pSysBuf    = &pOutObj->buffers[id];
        System_VideoFrameBuffer *pSysVidBuf = &pOutObj->videoFrames[id];
        pSysVidBuf->bufAddr[0] = OSA_memAllocSR(
                                           OSA_HEAPID_DDR_CACHED_SR1,
                                           imgSize,SYSTEM_BUFFER_ALIGNMENT);

        OSA_assert(pSysVidBuf->bufAddr[0] != NULL);

        System_exportDmaBuf(pSysVidBuf->bufAddr[0],
                            imgSize,
                            &pSysVidBuf->dmaFd[0]);
         
         pSysBuf->payload      = pSysVidBuf;
         pSysBuf->payloadSize  = sizeof(System_VideoFrameBuffer);
         pSysBuf->chNum        = 0;
         pSysBuf->bufType      = SYSTEM_BUFFER_TYPE_VIDEO_FRAME;
         pSysBuf->srcTimestamp = OSA_getCurGlobalTimeInUsec();
         pSysBuf->frameId      = 0;
         pSysBuf->linkLocalTimestamp = pSysBuf->srcTimestamp;
         for (planes = 1; planes < SYSTEM_MAX_PLANES; planes++)
         {
            pSysVidBuf->bufAddr[planes] = pSysVidBuf->bufAddr[0];
         }
         pOutObj->pBufVirAddr[id] = (unsigned char*)pSysVidBuf->bufAddr[0];
         pOutObj->pBufPhyAddr[id] = (unsigned char*)OSA_memVirt2Phys((unsigned int)pSysVidBuf->bufAddr[0], OSA_MEM_REGION_TYPE_SR1);

}

2. another process in A15,use physical address, code below:

memcpy(multiRenderBufInfo.bufInfo[putBufIdx].pVirtualAddr, sCarData.pPicData, DISPLAYW*DISPLAYH*4);

when  call this function it will report  "Segmentation fault", if it can't support physical address between two process, how can I share memory between two process?


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>