static OMX_ERRORTYPE Camera_SendCommand(OMX_IN OMX_HANDLETYPE hComponent,
    OMX_IN OMX_COMMANDTYPE eCmd,
    OMX_IN OMX_U32 nParam, OMX_IN OMX_PTR pCmdData)

{
    OMX_ERRORTYPE eError = OMX_ErrorNone, eCompReturn;
    static OMX_BOOL dcc_loaded = OMX_FALSE;
    OMX_ERRORTYPE dcc_eError = OMX_ErrorNone;
    OMX_COMPONENTTYPE *hComp = (OMX_COMPONENTTYPE *) hComponent;
    PROXY_COMPONENT_PRIVATE *pCompPrv;
    OMX_PROXY_CAM_PRIVATE   *pCamPrv;
    MEMPLUGIN_BUFFER_PARAMS delBuffer_params;
    MEMPLUGIN_BUFFER_PROPERTIES delBuffer_prop;
    pCompPrv = (PROXY_COMPONENT_PRIVATE *) hComp->pComponentPrivate;

    pCamPrv = (OMX_PROXY_CAM_PRIVATE*)pCompPrv->pCompProxyPrv;

    MEMPLUGIN_BUFFER_PARAMS_INIT(delBuffer_params);
    if ((eCmd == OMX_CommandStateSet) &&
        (nParam == (OMX_STATETYPE) OMX_StateIdle))
    {
        /* Allocate memory for Video VTC usecase, if applicable. */
        eError = _OMX_CameraVtcAllocateMemory(hComponent);
        if (eError != OMX_ErrorNone) {
            DOMX_ERROR("DOMX: _OMX_CameraVtcAllocateMemory completed with error 0x%x\n", eError);
            goto EXIT;
        }
        if (!dcc_loaded)
        {
            dcc_eError = DCC_Init(hComponent);
            if (dcc_eError != OMX_ErrorNone)
            {
                DOMX_ERROR(" Error in DCC Init");
            }
            /* Configure Ducati to use DCC buffer from A9 side
             *ONLY* if DCC_Init is successful. */
            if (dcc_eError == OMX_ErrorNone)
            {
                dcc_eError = send_DCCBufPtr(hComponent);
                if (dcc_eError != OMX_ErrorNone)
                {
                    DOMX_ERROR(" Error in Sending DCC Buf ptr");
                }
                DCC_DeInit(hComponent);
            }
            dcc_loaded = OMX_TRUE;
        }
    } else if (eCmd == OMX_CommandPortDisable) {
        int i, j;
        for (i = 0; i < PROXY_MAXNUMOFPORTS; i++) {
            if ((i == nParam) || (nParam == OMX_ALL)) {
                for (j = 0; j < MAX_NUM_INTERNAL_BUFFERS; j++) {
                     if (pCamPrv->gComponentBufferAllocation[i][j]) {
                     delBuffer_prop.sBuffer_accessor.pBufferHandle = pCamPrv->gComponentBufferAllocation[i][j];
                        MemPlugin_Free(pCompPrv->pMemPluginHandle, pCompPrv->nMemmgrClientDesc,
                                       &delBuffer_params,&delBuffer_prop);
                        pCamPrv->gComponentBufferAllocation[i][j] = NULL;
                    }
                }
            }
        }
    }

    if ((eCmd == OMX_CommandStateSet) &&
	(nParam == (OMX_STATETYPE) OMX_StateLoaded))
    {
        /* Clean up resources for Video VTC usecase. */
        OMX_CameraVtcFreeMemory(hComponent);
    }

    eError =
	PROXY_SendCommand(hComponent,eCmd,nParam,pCmdData);

EXIT:

   DOMX_EXIT("eError: %d", eError);
   return eError;
}
/* ===========================================================================*/
static OMX_ERRORTYPE _OMX_CameraVtcAllocateMemory(OMX_IN OMX_HANDLETYPE hComponent)
{
    OMX_ERRORTYPE eError = OMX_ErrorNone, eCompReturn = OMX_ErrorNone;
    OMX_STATETYPE tState= OMX_StateInvalid;
    PROXY_COMPONENT_PRIVATE *pCompPrv;
    OMX_PROXY_CAM_PRIVATE* pCamPrv;
    OMX_COMPONENTTYPE *hComp = (OMX_COMPONENTTYPE *) hComponent;
    OMX_U32 i = 0;
    OMX_CONFIG_RECTTYPE tFrameDim;
    OMX_U32 nFrmWidth, nFrmHeight;
    OMX_TI_PARAM_VTCSLICE tVtcConfig;
    RPC_OMX_ERRORTYPE eRPCError = RPC_OMX_ErrorNone;

    pCompPrv = (PROXY_COMPONENT_PRIVATE *) hComp->pComponentPrivate;
    pCamPrv = (OMX_PROXY_CAM_PRIVATE*)pCompPrv->pCompProxyPrv;

    _PROXY_OMX_INIT_PARAM(&tFrameDim, OMX_CONFIG_RECTTYPE);
    _PROXY_OMX_INIT_PARAM(&tVtcConfig, OMX_TI_PARAM_VTCSLICE);

    /* Get the current state of the component */
    eError = OMX_GetState(hComponent, &tState);
    if(OMX_ErrorNone != eError)
    {
        DOMX_ERROR("%s: Error in fetching current state - %d", __func__, tState);
    }
    else
    {
        if (tState == OMX_StateLoaded) {
            DOMX_DEBUG("%s: Current state returned is %d", __func__, tState);

            if(OMX_GetParameter(hComponent, OMX_TI_IndexParamVtcSlice, &tVtcConfig) == OMX_ErrorNone) {
                if (tVtcConfig.nSliceHeight != 0 ) {
                    OMX_CONFIG_BOOLEANTYPE tVstabParam;
                    OMX_PARAM_VIDEONOISEFILTERTYPE tVnfParam;
                    OMX_TI_PARAM_VTCSLICE *pVtcConfig = &tVtcConfig;

                    tFrameDim.nPortIndex = PREVIEW_PORT; //Preview Port
                    if(OMX_GetParameter(hComponent, OMX_TI_IndexParam2DBufferAllocDimension, &tFrameDim) == OMX_ErrorNone){
                        DOMX_DEBUG("Acquired OMX_TI_IndexParam2DBufferAllocDimension data. nWidth = %d, nHeight = %d.\n\n", tFrameDim.nWidth, tFrameDim.nHeight);
                        nFrmWidth = tFrameDim.nWidth;
                        nFrmHeight = tFrameDim.nHeight;
                    }else {
                        DOMX_DEBUG("%s: No OMX_TI_IndexParam2DBufferAllocDimension data.\n\n", __func__);
                        nFrmWidth = MAX_VTC_WIDTH_WITH_VNF;
                        nFrmHeight = MAX_VTC_HEIGHT_WITH_VNF;
                    }

                    _PROXY_OMX_INIT_PARAM(&tVnfParam, OMX_PARAM_VIDEONOISEFILTERTYPE);
                    _PROXY_OMX_INIT_PARAM(&tVstabParam, OMX_CONFIG_BOOLEANTYPE);
                    eError = OMX_GetParameter(hComponent, OMX_IndexParamFrameStabilisation, &tVstabParam);
                    if(eError != OMX_ErrorNone) {
                        DOMX_ERROR("OMX_GetParameter for OMX_IndexParamFrameStabilisation returned error %x", eError);
                        goto EXIT;
                    }
                    tVnfParam.nPortIndex = PREVIEW_PORT;
                    eError = OMX_GetParameter(hComponent, OMX_IndexParamVideoNoiseFilter, &tVnfParam);
                    if(eError != OMX_ErrorNone) {
                        DOMX_ERROR("OMX_GetParameter for OMX_IndexParamVideoNoiseFilter returned error %x", eError);
                        goto EXIT;
                    }
                    DOMX_DEBUG(" Acquired OMX_TI_IndexParamVtcSlice data. nSliceHeight = %d, bVstabOn = %d, Vnfmode = %d, nWidth = %d, nHeight = %d.\n\n", tVtcConfig.nSliceHeight, tVstabParam.bEnabled, tVnfParam.eMode, nFrmWidth, nFrmHeight);
                    if (tVstabParam.bEnabled == OMX_FALSE && tVnfParam.eMode != OMX_VideoNoiseFilterModeOff) {
                        eError = GLUE_CameraVtcAllocateMemory(hComponent,
                                                              pVtcConfig,
                                                              nFrmWidth,
                                                              nFrmHeight);
                        if(eError != OMX_ErrorNone) {
                           DOMX_ERROR("Allocate Memory for vtc config returned error %x", eError);
                           goto EXIT;
                        }
                   }
                }
            }
        }
    }
EXIT:

   DOMX_EXIT("eError: %d", eError);
   return eError;
}
/* ===========================================================================*/
RPC_OMX_ERRORTYPE RPC_SendCommand(RPC_OMX_HANDLE hRPCCtx,
    OMX_COMMANDTYPE eCmd, OMX_U32 nParam, OMX_PTR pCmdData,
    OMX_ERRORTYPE * eCompReturn)
{
	RPC_OMX_ERRORTYPE eRPCError = RPC_OMX_ErrorNone;
	RcmClient_Message *pPacket = NULL;
	RcmClient_Message *pRetPacket = NULL;
	OMX_U32 nPacketSize = PACKET_SIZE;
	RPC_OMX_MESSAGE *pRPCMsg = NULL;
	RPC_OMX_BYTE *pMsgBody;
	RPC_INDEX fxnIdx;
	OMX_U32 nPos = 0;
	OMX_S16 status;
	RPC_OMX_CONTEXT *hCtx = hRPCCtx;
	RPC_OMX_HANDLE hComp = hCtx->remoteHandle;

	OMX_U32 structSize = 0;
	OMX_U32 offset = 0;

	DOMX_ENTER("");

	RPC_exitOnDucatiFault();

	fxnIdx =
	    rpcHndl[TARGET_CORE_ID].rpcFxns[RPC_OMX_FXN_IDX_SEND_CMD].
	    rpcFxnIdx;

	//Allocating remote command message
	RPC_getPacket(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], nPacketSize,
	    pPacket);
	pRPCMsg = (RPC_OMX_MESSAGE *) (&pPacket->data);
	pMsgBody = &pRPCMsg->msgBody[0];

	//Marshalled:[>hComp|>eCmd|nParam|>offset(pCmdData)|!><--pCmdData--]

	RPC_SETFIELDVALUE(pMsgBody, nPos, hComp, RPC_OMX_HANDLE);
	RPC_SETFIELDVALUE(pMsgBody, nPos, eCmd, OMX_COMMANDTYPE);
	RPC_SETFIELDVALUE(pMsgBody, nPos, nParam, OMX_U32);

	offset =
	    sizeof(RPC_OMX_HANDLE) + sizeof(OMX_COMMANDTYPE) +
	    sizeof(OMX_U32) + sizeof(OMX_U32);

	RPC_SETFIELDOFFSET(pMsgBody, nPos, offset, OMX_U32);

	if (pCmdData != NULL && eCmd == OMX_CommandMarkBuffer)
	{
		/*The RPC_UTIL_GETSTRUCTSIZE will not work here since OMX_MARKTYPE structure
		   does not have nSize field */
		structSize = sizeof(OMX_MARKTYPE);
		RPC_SETFIELDCOPYGEN(pMsgBody, offset, pCmdData, structSize);
	} else if (pCmdData != NULL)
	{
		structSize = RPC_UTIL_GETSTRUCTSIZE(pCmdData);
		RPC_SETFIELDCOPYGEN(pMsgBody, offset, pCmdData, structSize);
	}

	pPacket->poolId = hCtx->nPoolId;
	pPacket->jobId = hCtx->nJobId;
	RPC_sendPacket_sync(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], pPacket,
	    fxnIdx, pRetPacket);
	pRPCMsg = (RPC_OMX_MESSAGE *) (&pRetPacket->data);
	pMsgBody = &pRPCMsg->msgBody[0];

	*eCompReturn = pRPCMsg->msgHeader.nOMXReturn;

	RPC_freePacket(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], pRetPacket);

      EXIT:
	DOMX_EXIT("");
	return eRPCError;
}
/* ===========================================================================*/
RPC_OMX_ERRORTYPE RPC_GetConfig(RPC_OMX_HANDLE hRPCCtx,
    OMX_INDEXTYPE nConfigIndex, OMX_PTR pCompConfig,
    OMX_ERRORTYPE * eCompReturn)
{
	RPC_OMX_ERRORTYPE eRPCError = RPC_OMX_ErrorNone;
	RcmClient_Message *pPacket = NULL;
	RcmClient_Message *pRetPacket = NULL;
	OMX_U32 nPacketSize = PACKET_SIZE;
	RPC_OMX_MESSAGE *pRPCMsg = NULL;
	RPC_OMX_BYTE *pMsgBody;
	RPC_INDEX fxnIdx;
	OMX_U32 nPos = 0;
	OMX_S16 status;
	RPC_OMX_CONTEXT *hCtx = hRPCCtx;
	RPC_OMX_HANDLE hComp = hCtx->remoteHandle;

	OMX_U32 structSize = 0;
	OMX_U32 offset = 0;

	DOMX_ENTER("");

	RPC_exitOnDucatiFault();

	fxnIdx =
	    rpcHndl[TARGET_CORE_ID].rpcFxns[RPC_OMX_FXN_IDX_GET_CONFIG].
	    rpcFxnIdx;

	//Allocating remote command message
	RPC_getPacket(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], nPacketSize,
	    pPacket);
	pRPCMsg = (RPC_OMX_MESSAGE *) (&pPacket->data);
	pMsgBody = &pRPCMsg->msgBody[0];

	//Marshalled:[>hComp|>nConfigIndex|>offset(pCompConfig)|><--pCompConfig--]

	RPC_SETFIELDVALUE(pMsgBody, nPos, hComp, RPC_OMX_HANDLE);
	RPC_SETFIELDVALUE(pMsgBody, nPos, nConfigIndex, OMX_INDEXTYPE);

	offset =
	    sizeof(RPC_OMX_HANDLE) + sizeof(OMX_INDEXTYPE) + sizeof(OMX_U32);
	RPC_SETFIELDOFFSET(pMsgBody, nPos, offset, OMX_U32);

	structSize = RPC_UTIL_GETSTRUCTSIZE(pCompConfig);
	RPC_SETFIELDCOPYGEN(pMsgBody, offset, pCompConfig, structSize);

	pPacket->poolId = hCtx->nPoolId;
	pPacket->jobId = hCtx->nJobId;
	RPC_sendPacket_sync(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], pPacket,
	    fxnIdx, pRetPacket);
	pRPCMsg = (RPC_OMX_MESSAGE *) (&pRetPacket->data);
	pMsgBody = &pRPCMsg->msgBody[0];

	*eCompReturn = pRPCMsg->msgHeader.nOMXReturn;

	if (pRPCMsg->msgHeader.nOMXReturn == RPC_OMX_ErrorNone)
	{
		RPC_GETFIELDCOPYGEN(pMsgBody, offset, pCompConfig,
		    structSize);
	}

	RPC_freePacket(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], pRetPacket);

      EXIT:
	DOMX_EXIT("");
	return eRPCError;
}
/* ===========================================================================*/
RPC_OMX_ERRORTYPE RPC_GetHandle(RPC_OMX_HANDLE hRPCCtx,
    OMX_STRING cComponentName, OMX_PTR pAppData,
    OMX_CALLBACKTYPE * pCallBacks, OMX_ERRORTYPE * eCompReturn)
{
	RPC_OMX_ERRORTYPE eRPCError = RPC_OMX_ErrorNone;
	RPC_OMX_MESSAGE *pRPCMsg = NULL;
	RPC_OMX_BYTE *pMsgBody = NULL;
	OMX_U32 dataOffset = 0;
	OMX_U32 dataOffset2 = 0;
	OMX_U32 offset = 0;
	OMX_U32 nPacketSize = PACKET_SIZE;
	RcmClient_Message *pPacket = NULL;
	RcmClient_Message *pRetPacket = NULL;
	OMX_U32 nPos = 0;
	RPC_OMX_CONTEXT *hCtx = hRPCCtx;
	RPC_OMX_HANDLE hComp = NULL;
	OMX_HANDLETYPE hActualComp = NULL;

	OMX_S16 status;
	RPC_INDEX fxnIdx;
	OMX_STRING CallingCorercmServerName;

	OMX_S32 pid = 0;	//For TILER memory allocation changes

	DOMX_ENTER("");
	DOMX_DEBUG("RPC_GetHandle: Recieved GetHandle request from %s",
	    cComponentName);

	RPC_exitOnDucatiFault();

	RPC_UTIL_GetLocalServerName(cComponentName,
	    &CallingCorercmServerName);
	DOMX_DEBUG(" RCM Server Name Calling on Current Core: %s",
	    CallingCorercmServerName);

	fxnIdx =
	    rpcHndl[TARGET_CORE_ID].rpcFxns[RPC_OMX_FXN_IDX_GET_HANDLE].
	    rpcFxnIdx;

	//Allocating remote command message
	RPC_getPacket(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], nPacketSize,
	    pPacket);
	pRPCMsg = (RPC_OMX_MESSAGE *) (&pPacket->data);
	pMsgBody = &pRPCMsg->msgBody[0];

	//Marshalled:[>offset(cParameterName)|>pAppData|>offset(CallingCorercmServerName)|>pid|
	//>--cComponentName--|>--CallingCorercmServerName--|
	//<hComp]

	dataOffset =
	    sizeof(OMX_U32) + sizeof(OMX_PTR) + sizeof(OMX_U32) +
	    sizeof(OMX_S32);
	RPC_SETFIELDOFFSET(pMsgBody, nPos, dataOffset, OMX_U32);
	//To update with RPC macros
	strcpy((char *)(pMsgBody + dataOffset), cComponentName);

	RPC_SETFIELDVALUE(pMsgBody, nPos, pAppData, OMX_PTR);

	dataOffset2 = dataOffset + 128;	//max size of omx comp name
	RPC_SETFIELDOFFSET(pMsgBody, nPos, dataOffset2, OMX_U32);
	//To update with RPC macros
	strcpy((char *)(pMsgBody + dataOffset2), CallingCorercmServerName);

	//Towards TILER memory allocation changes
	pid = getpid();
	RPC_SETFIELDVALUE(pMsgBody, nPos, pid, OMX_S32);

	pPacket->poolId = hCtx->nPoolId;
	pPacket->jobId = hCtx->nJobId;

	RPC_sendPacket_sync(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], pPacket,
	    fxnIdx, pRetPacket);

	pRPCMsg = (RPC_OMX_MESSAGE *) (&pRetPacket->data);
	pMsgBody = &pRPCMsg->msgBody[0];

	*eCompReturn = pRPCMsg->msgHeader.nOMXReturn;

	if (*eCompReturn == OMX_ErrorNone)
	{
		offset = dataOffset2 + 32;	//max size of rcm server name
		RPC_GETFIELDVALUE(pMsgBody, offset, hComp, RPC_OMX_HANDLE);
		DOMX_DEBUG("Received Remote Handle 0x%x", hComp);
		hCtx->remoteHandle = hComp;
		/* The handle received above is used for all communications
		   with the remote component but is not the actual component
		   handle (it is actually the rpc context handle which
		   contains lot of other info). The handle recd. below is the
		   actual remote component handle. This is used at present for
		   mark buffer implementation since in that case it is not
		   feasible to send the context handle */
		RPC_GETFIELDVALUE(pMsgBody, offset, hActualComp,
		    OMX_HANDLETYPE);
		hCtx->hActualRemoteCompHandle = hActualComp;
	}

	RPC_freePacket(hCtx->ClientHndl[RCM_DEFAULT_CLIENT], pRetPacket);

      EXIT:
	DOMX_EXIT("");
	return eRPCError;
}
MEMPLUGIN_ERRORTYPE MemPlugin_ION_Alloc(void *pMemPluginHandle, OMX_U32 nClient,
                                    MEMPLUGIN_BUFFER_PARAMS *pIonBufferParams,
                                    MEMPLUGIN_BUFFER_PROPERTIES *pIonBufferProp)
{
    OMX_S16 ret;
    struct ion_handle *temp;
    size_t stride;
    MEMPLUGIN_ERRORTYPE eError = MEMPLUGIN_ERROR_NONE;
    MEMPLUGIN_ION_PARAMS sIonParams;
    MEMPLUGIN_OBJECT    *pMemPluginHdl = (MEMPLUGIN_OBJECT *)pMemPluginHandle;

    if(pIonBufferParams->nWidth <= 0)
    {
        eError = MEMPLUGIN_ERROR_BADPARAMETER;
        DOMX_ERROR("%s: width should be positive %d", __FUNCTION__,pIonBufferParams->nWidth);
        goto EXIT;
    }

    if(pMemPluginHdl->pPluginExtendedInfo == NULL)
    {
        MEMPLUGIN_ION_PARAMS_INIT(&sIonParams);
    }
    else
    {
        MEMPLUGIN_ION_PARAMS_COPY(((MEMPLUGIN_ION_PARAMS *)pMemPluginHdl->pPluginExtendedInfo),sIonParams);
    }
    if(pIonBufferParams->eBuffer_type == DEFAULT)
    {
        ret = (OMX_S16)ion_alloc(nClient,
                                    pIonBufferParams->nWidth,
                                    sIonParams.nAlign,
                                    sIonParams.alloc_flags,
                                    &temp);
        if(ret || (int)temp == -ENOMEM)
        {
            if(sIonParams.alloc_flags != OMAP_ION_HEAP_SECURE_INPUT)
            {
               //for non default types of allocation - no retry with tiler 1d - throw error
//STARGO: ducati secure heap is too small, need to allocate from heap
#if 0
               DOMX_ERROR("FAILED to allocate secure buffer of size=%d. ret=0x%x",pIonBufferParams->nWidth, ret);
               eError = MEMPLUGIN_ERROR_NORESOURCES;
               goto EXIT;
#endif
               DOMX_ERROR("FAILED to allocate secure buffer of size=%d. ret=0x%x - trying tiler 1d space",pIonBufferParams->nWidth, ret);
               pIonBufferParams->eBuffer_type = TILER1D;
               pIonBufferParams->eTiler_format = MEMPLUGIN_TILER_FORMAT_PAGE;
               sIonParams.alloc_flags = OMAP_ION_HEAP_TILER_MASK;
               sIonParams.nAlign = -1;
            }
            else
            {
                // for default non tiler (OMAP_ION_HEAP_SECURE_INPUT) retry allocating from tiler 1D
                DOMX_DEBUG("FAILED to allocate from non tiler space - trying tiler 1d space");
                pIonBufferParams->eBuffer_type = TILER1D;
                pIonBufferParams->eTiler_format = MEMPLUGIN_TILER_FORMAT_PAGE;
                sIonParams.alloc_flags = OMAP_ION_HEAP_TILER_MASK;
                sIonParams.nAlign = -1;
            }
        }
    }
    if(pIonBufferParams->eBuffer_type == TILER1D)
    {
        ret = (OMX_S16)ion_alloc_tiler(nClient,
                                        pIonBufferParams->nWidth,
                                        pIonBufferParams->nHeight,
                                        pIonBufferParams->eTiler_format,
                                        sIonParams.alloc_flags,
                                        &temp,
                                        &(pIonBufferProp->nStride));

         if (ret || ((int)temp == -ENOMEM))
         {
               DOMX_ERROR("FAILED to allocate buffer of size=%d. ret=0x%x",pIonBufferParams->nWidth, ret);
               eError = MEMPLUGIN_ERROR_NORESOURCES;
               goto EXIT;
         }
    }
    else if(pIonBufferParams->eBuffer_type == TILER2D)
    {
        DOMX_ERROR("Tiler 2D not implemented");
        eError = MEMPLUGIN_ERROR_NOTIMPLEMENTED;
        goto EXIT;
    }
    else if(!temp)
    {
        DOMX_ERROR("Undefined option for buffer type");
        eError = MEMPLUGIN_ERROR_UNDEFINED;
        goto EXIT;
    }
    pIonBufferProp->sBuffer_accessor.pBufferHandle = (OMX_PTR)temp;
    pIonBufferProp->nStride =  stride;

    if(pIonBufferParams->bMap == OMX_TRUE)
    {
        ret = (OMX_S16) ion_map(nClient,
                                pIonBufferProp->sBuffer_accessor.pBufferHandle,
                                pIonBufferParams->nWidth*pIonBufferParams->nHeight,
                                sIonParams.prot,
                                sIonParams.map_flags,
                                sIonParams.nOffset,
                                (unsigned char **) &(pIonBufferProp->sBuffer_accessor.pBufferMappedAddress),
                                &(pIonBufferProp->sBuffer_accessor.bufferFd));

        if(ret < 0)
        {
                DOMX_ERROR("userspace mapping of ION buffers returned error");
                eError = MEMPLUGIN_ERROR_NORESOURCES;
                goto EXIT;
        }
    }
    else
    {
        ret = (OMX_S16) ion_share(nClient,
                                    pIonBufferProp->sBuffer_accessor.pBufferHandle,
                                    &(pIonBufferProp->sBuffer_accessor.bufferFd));
        if(ret < 0)
        {
                DOMX_ERROR("ION share returned error");
                eError = MEMPLUGIN_ERROR_NORESOURCES;
                goto EXIT;
        }
    }
EXIT:
      if (eError != MEMPLUGIN_ERROR_NONE) {
          DOMX_EXIT("%s exited with error 0x%x",__FUNCTION__,eError);
         return eError;
      }
      else {
          DOMX_EXIT("%s executed successfully",__FUNCTION__);
         return MEMPLUGIN_ERROR_NONE;
      }
}