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.

How to use Shared Region between A8 application and OMX VLPB component

Hello all, 

I am writing custom image conversion algorithms on an A8 Linux that implements an OMX VLPB component from the EZSDK 5.05 and OMX Version 05.02.00.48.

The Shared Region API I am using is from SysLink 2.20.02.20.

I have implemented the OMX VLPB component using custom conversion algorithms successfully, however, we are using memcpy to pass frames to the OMX input buffers and another memcpy to fetch the converted frames from the OMX output buffer. These memcpy's are too expensive for our goals. We would like to allocate OMX buffer memory from a SharedRegion that both the application and OMX can see. 

I have carefully followed the decode_mosaicdisplay example from EZSDK but I am having problems with getting SR heap memory:

heap = SharedRegion_getHeap(2);

Is giving the assertion error:

.... (id < SharedRegion_module->cfg.numEntries) : failed

Although I believe the default memory configurations should support the use of Shared Region with id=2, I have tried loading my own memory configuration using the firmware_loader -mmap feature to no avail (resulting in the same output error).


I have dug a little into the SharedRegion source code (to see if my memory settings are being considered), and it seems that a SharedRegion_setup() function call is required to save memory configuration settings, although it is not used in the decode_mosaicdisplay example and it seems as though it is never called in the SR source code. I tried calling SharedRegion_setup() from my application, and it seems as though the library Memory_copy() function (that copies configuration settings to the global SharedRegion_module struct) is broken: when I replaced this Memory_copy with a standard memcpy, it started copying settings successfully (I did not investigate this further). At this point I am still receiving errors with SharedRegion_getHeap(), specifically, SharedRegionDrv_ioctl(CMD_SHAREDREGION_SETUP, args) is returning a bad status error.

Before I dig any further, I would like some additional input on my solution:

1) Is using SharedRegion buffers between the application and OMX a suitable solution to reduce memcpy calls?

2) Is there any additional dependencies or configuration required to get the SharedRegion API working? (anything not implemented/described in decode_mosaicdisplay example, or anything I didn't mention)

Thanks!

Justin