summaryrefslogtreecommitdiffstats
path: root/domx
diff options
context:
space:
mode:
authorEmilian Peev <epeev@mm-sol.com>2012-08-20 10:57:23 +0300
committerVidhoon Viswanathan <vidhoon@ti.com>2012-08-21 16:31:22 +0530
commit253299c921514582a4d47cb1ca802cbda5eae7eb (patch)
treeb3a9dcc3d37e4c8b461570a1e2f638b0d00554a2 /domx
parentb858f46dacece7f1c15a8c58dd9ffdf8a7de3c3f (diff)
downloadhardware_ti_omap4-253299c921514582a4d47cb1ca802cbda5eae7eb.zip
hardware_ti_omap4-253299c921514582a4d47cb1ca802cbda5eae7eb.tar.gz
hardware_ti_omap4-253299c921514582a4d47cb1ca802cbda5eae7eb.tar.bz2
DOMX: Allow 1D gralloc buffers
For CPCAM usecases, gralloc buffers could be 1D also. This patch makes corresponding changes in DOMX to allow this. - In RPC_RegisterBuffer, looks for num_handles returned from rpmsg ioctl call and returns the corresponding valid handles only. Rest are NULL. - While passing gralloc buffers to ducati via UseBuffer call, fetch only number of components as indicated in pBuffer->numFds. Set other place holders to NULL. This patch has a kernel dependency: http://review.omapzoom.org/#/c/26668/ Change-Id: Ief80d45e8cbe4719aca4eaf09200b2034078e688 Signed-off-by: Emilian Peev <epeev@mm-sol.com> Signed-off-by: Vidhoon Viswanathan <vidhoon@ti.com>
Diffstat (limited to 'domx')
-rw-r--r--domx/omx_proxy_common/src/omx_proxy_common.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/domx/omx_proxy_common/src/omx_proxy_common.c b/domx/omx_proxy_common/src/omx_proxy_common.c
index fc37a51..2988fe6 100644
--- a/domx/omx_proxy_common/src/omx_proxy_common.c
+++ b/domx/omx_proxy_common/src/omx_proxy_common.c
@@ -210,13 +210,21 @@ RPC_OMX_ERRORTYPE RPC_RegisterBuffer(OMX_HANDLETYPE hRPCCtx, int fd1, int fd2,
eRPCError = RPC_OMX_ErrorBadParameter;
goto EXIT;
}
- if (pvr_data.handles[1])
- *handle2 = pvr_data.handles[1];
+ if(pvr_data.num_handles > 1)
+ {
+ if (pvr_data.handles[1])
+ *handle2 = pvr_data.handles[1];
+ else
+ {
+ DOMX_ERROR("Registration failed - Invalid fd passed for gralloc - reg handle (UV) is NULL num_handles: %d",pvr_data.num_handles);
+ eRPCError = RPC_OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ }
else
{
- DOMX_ERROR("Registration failed - Invalid fd passed for gralloc - reg handle (UV) is NULL");
- eRPCError = RPC_OMX_ErrorBadParameter;
- goto EXIT;
+ DOMX_DEBUG("Gralloc buffer has only one component");
+ *handle2 = NULL;
}
#else
DOMX_ERROR("No Registerbuffer implementation for gralloc - macro mess up!");
@@ -262,7 +270,7 @@ RPC_OMX_ERRORTYPE RPC_UnRegisterBuffer(OMX_HANDLETYPE hRPCCtx, OMX_PTR handle1,
struct ion_fd_data data;
RPC_OMX_CONTEXT *pRPCCtx = (RPC_OMX_CONTEXT *) hRPCCtx;
- if ((handle1 == NULL) || (((proxyBufferType == GrallocPointers) || (proxyBufferType == BufferDescriptorVirtual2D)) && (handle2 == NULL))) {
+ if ((handle1 == NULL) || ((proxyBufferType == BufferDescriptorVirtual2D) && (handle2 == NULL))) {
eRPCError = RPC_OMX_ErrorBadParameter;
goto EXIT;
}
@@ -275,11 +283,14 @@ RPC_OMX_ERRORTYPE RPC_UnRegisterBuffer(OMX_HANDLETYPE hRPCCtx, OMX_PTR handle1,
eRPCError = RPC_OMX_ErrorInsufficientResources;
//unregisterbuffer will proceed to unregister handle2 even if handle1 unregister ioctl call failed"
}
- data.handle = handle2;
- status = ioctl(pRPCCtx->fd_omx, OMX_IOCIONUNREGISTER, &data);
- if (status < 0) {
- DOMX_ERROR("UnregisterBuffer ioctl call failed for handle2: 0x%x",handle2);
- eRPCError = RPC_OMX_ErrorInsufficientResources;
+ if(handle2 != NULL)
+ {
+ data.handle = handle2;
+ status = ioctl(pRPCCtx->fd_omx, OMX_IOCIONUNREGISTER, &data);
+ if (status < 0) {
+ DOMX_ERROR("UnregisterBuffer ioctl call failed for handle2: 0x%x",handle2);
+ eRPCError = RPC_OMX_ErrorInsufficientResources;
+ }
}
if(eRPCError != RPC_OMX_ErrorNone)
goto EXIT;
@@ -1064,8 +1075,15 @@ static OMX_ERRORTYPE PROXY_UseBuffer(OMX_IN OMX_HANDLETYPE hComponent,
{
//Extracting buffer pointer from the gralloc buffer
pAuxBuf0 = (OMX_U8 *)(((IMG_native_handle_t*)pBuffer)->fd[0]);
- ((OMX_TI_PLATFORMPRIVATE *) pBufferHeader->pPlatformPrivate)->
- pAuxBuf1 = (OMX_U8 *)(((IMG_native_handle_t*)pBuffer)->fd[1]);
+ if(((native_handle_t*)pBuffer)->numFds > 1) {
+ ((OMX_TI_PLATFORMPRIVATE *) pBufferHeader->pPlatformPrivate)->
+ pAuxBuf1 = (OMX_U8 *)(((IMG_native_handle_t*)pBuffer)->fd[1]);
+ }
+ else {
+ DOMX_DEBUG("Gralloc buffer has only one component");
+ ((OMX_TI_PLATFORMPRIVATE *) pBufferHeader->pPlatformPrivate)->
+ pAuxBuf1 = NULL;
+ }
}
#endif