summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunita Nadampalli <sunitan@ti.com>2015-01-27 10:40:53 -0600
committerSunita Nadampalli <sunitan@ti.com>2015-01-27 10:40:53 -0600
commit5a735b9b0c137706d982c046f71ec56450f47bf1 (patch)
tree1707c33b131bce59b3dff5fba23e7dc7280a31f4
parentb91319b71d0a4d85f85f0c44fb9a6db9360c6da8 (diff)
downloaddra7xx-5a735b9b0c137706d982c046f71ec56450f47bf1.tar.gz
OMX: Add decoder o/p buffer register/unregister calls with dce
With GEM memory allocator, the buffer pinning to TILER space is dynamic. In order to keep the decoder o/p buffer (which are also used for reference by the codec algorithms) always pinned, they need to be explicitly registered and unregistered through IPC. Change-Id: I072298c2b89af9a2fa95f5d868bb685a40247c72 Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
-rw-r--r--omx/base/omx_base_comp/inc/omx_base.h2
-rw-r--r--omx/base/omx_base_comp/src/omx_base.c7
-rw-r--r--omx/videodecode/omx_videodec_common/inc/omx_video_decoder.h2
-rw-r--r--omx/videodecode/omx_videodec_common/src/omx_video_decoder.c9
4 files changed, 16 insertions, 4 deletions
diff --git a/omx/base/omx_base_comp/inc/omx_base.h b/omx/base/omx_base_comp/inc/omx_base.h
index 0a920f6..2690133 100644
--- a/omx/base/omx_base_comp/inc/omx_base.h
+++ b/omx/base/omx_base_comp/inc/omx_base.h
@@ -121,7 +121,7 @@ typedef struct OMXBaseComp
OMX_ERRORTYPE (*fpReturnEventNotify)(OMX_HANDLETYPE hComponent, OMX_EVENTTYPE eEvent,
OMX_U32 nEventData1, OMX_U32 nEventData2, OMX_PTR pEventData);
- OMX_ERRORTYPE (*fpXlateBuffHandle)(OMX_HANDLETYPE hComponent, OMX_PTR pBufferHdr);
+ OMX_ERRORTYPE (*fpXlateBuffHandle)(OMX_HANDLETYPE hComponent, OMX_PTR pBufferHdr, OMX_BOOL bRegister);
}OMXBaseComp;
diff --git a/omx/base/omx_base_comp/src/omx_base.c b/omx/base/omx_base_comp/src/omx_base.c
index 2834612..e701715 100644
--- a/omx/base/omx_base_comp/src/omx_base.c
+++ b/omx/base/omx_base_comp/src/omx_base.c
@@ -908,7 +908,7 @@ OMX_ERRORTYPE OMXBase_UseBuffer(OMX_HANDLETYPE hComponent,
(*ppBufferHdr)->nAllocLen = nSizeBytes;
if (pBaseComp->fpXlateBuffHandle != NULL) {
- eError = pBaseComp->fpXlateBuffHandle(hComponent, (OMX_PTR)(*ppBufferHdr));
+ eError = pBaseComp->fpXlateBuffHandle(hComponent, (OMX_PTR)(*ppBufferHdr), OMX_TRUE);
}
pPort->nBufferCnt++;
@@ -955,6 +955,11 @@ OMX_ERRORTYPE OMXBase_FreeBuffer(OMX_HANDLETYPE hComponent,
freed*/
OMX_CHECK(pPort->nBufferCnt != 0, OMX_ErrorBadParameter);
+ /* unregister the buffer with decoder for non-allocator port*/
+ if (!pPort->bIsBufferAllocator && pBaseComp->fpXlateBuffHandle != NULL) {
+ eError = pBaseComp->fpXlateBuffHandle(hComponent, (OMX_PTR)(pBuffHeader), OMX_FALSE);
+ }
+
/* Just decrement the buffer count and unpopulate the port,
* buffer header pool is freed up once all the buffers are received */
pPort->nBufferCnt--;
diff --git a/omx/videodecode/omx_videodec_common/inc/omx_video_decoder.h b/omx/videodecode/omx_videodec_common/inc/omx_video_decoder.h
index 387a420..c3d1832 100644
--- a/omx/videodecode/omx_videodec_common/inc/omx_video_decoder.h
+++ b/omx/videodecode/omx_videodec_common/inc/omx_video_decoder.h
@@ -134,7 +134,7 @@ OMX_ERRORTYPE OMXVidDec_CommandNotify(OMX_HANDLETYPE hComponent, OMX_COMMANDTYPE
OMX_ERRORTYPE OMXVidDec_DataNotify(OMX_HANDLETYPE hComponent);
-OMX_ERRORTYPE OMXVidDec_XlateBuffHandle(OMX_HANDLETYPE hComponent, OMX_PTR pBufferHdr);
+OMX_ERRORTYPE OMXVidDec_XlateBuffHandle(OMX_HANDLETYPE hComponent, OMX_PTR pBufferHdr, OMX_BOOL bRegister);
OMX_ERRORTYPE OMXVidDec_GetExtensionIndex(OMX_HANDLETYPE hComponent, OMX_STRING cParameterName,
OMX_INDEXTYPE *pIndexType);
diff --git a/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c b/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c
index 596ef3d..072b84c 100644
--- a/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c
+++ b/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c
@@ -562,7 +562,7 @@ EXIT:
* Video Decoder xlateBuffer Handles
*/
OMX_ERRORTYPE OMXVidDec_XlateBuffHandle(OMX_HANDLETYPE hComponent,
- OMX_PTR pBufferHdr)
+ OMX_PTR pBufferHdr, OMX_BOOL bRegister)
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_COMPONENTTYPE *pComp = NULL;
@@ -588,6 +588,13 @@ OMX_ERRORTYPE OMXVidDec_XlateBuffHandle(OMX_HANDLETYPE hComponent,
//populate the DMA BUFF_FDs from the gralloc pointers
for ( i = 0; i < MAX_PLANES_PER_BUFFER; i++ ) {
((OMXBase_BufHdrPvtData *)(pOMXBufHeader->pPlatformPrivate))->sMemHdr[i].dma_buf_fd = (OMX_U32)(((IMG_native_handle_t*)(pOMXBufHeader->pBuffer))->fd[i]);
+ if (((OMXBase_BufHdrPvtData *)(pOMXBufHeader->pPlatformPrivate))->sMemHdr[i].dma_buf_fd > 0) {
+ if (bRegister) {
+ dce_buf_lock(1, (size_t *)&(((OMXBase_BufHdrPvtData *)(pOMXBufHeader->pPlatformPrivate))->sMemHdr[i].dma_buf_fd));
+ } else {
+ dce_buf_unlock(1, (size_t *)&(((OMXBase_BufHdrPvtData *)(pOMXBufHeader->pPlatformPrivate))->sMemHdr[i].dma_buf_fd));
+ }
+ }
}
}