OMX_IN OMX_U32 width,
OMX_IN OMX_U32 height,
OMX_IN OMX_COLOR_FORMATTYPE format,
+ OMX_OUT OMX_U32 *pStride,
OMX_OUT OMX_PTR planes)
{
FunctionIn();
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
buffer_handle_t bufferHandle = (buffer_handle_t) handle;
private_handle_t *priv_hnd = (private_handle_t *) bufferHandle;
- Rect bounds(width, height);
+ Rect bounds((uint32_t)width, (uint32_t)height);
ExynosVideoPlane *vplanes = (ExynosVideoPlane *) planes;
void *vaddr[MAX_BUFFER_PLANE];
vplanes[2].offset = 0;
vplanes[2].addr = vaddr[2];
+ *pStride = priv_hnd->stride;
+
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%s: buffer locked: 0x%x", __func__, *vaddr);
EXIT:
return nStride;
}
-OMX_ERRORTYPE Exynos_OSAL_LockANB(
- OMX_IN OMX_PTR pBuffer,
- OMX_IN OMX_U32 width,
- OMX_IN OMX_U32 height,
- OMX_IN OMX_COLOR_FORMATTYPE format,
- OMX_OUT OMX_U32 *pStride,
- OMX_OUT OMX_PTR planes)
-{
- FunctionIn();
-
- OMX_ERRORTYPE ret = OMX_ErrorNone;
- android_native_buffer_t *pANB = (android_native_buffer_t *) pBuffer;
-
- ret = Exynos_OSAL_LockANBHandle((OMX_U32)pANB->handle, width, height, format, planes);
- *pStride = pANB->stride;
-
-EXIT:
- FunctionOut();
-
- return ret;
-}
-
-OMX_ERRORTYPE Exynos_OSAL_UnlockANB(OMX_IN OMX_PTR pBuffer)
-{
- FunctionIn();
-
- OMX_ERRORTYPE ret = OMX_ErrorNone;
- android_native_buffer_t *pANB = (android_native_buffer_t *) pBuffer;
-
- ret = Exynos_OSAL_UnlockANBHandle((OMX_U32)pANB->handle);
-
-EXIT:
- FunctionOut();
-
- return ret;
-}
-
OMX_ERRORTYPE Exynos_OSAL_LockMetaData(
OMX_IN OMX_PTR pBuffer,
OMX_IN OMX_U32 width,
ret = Exynos_OSAL_GetInfoFromMetaData((OMX_BYTE)pBuffer, &pBuf);
if (ret == OMX_ErrorNone) {
- ret = Exynos_OSAL_LockANBHandle((OMX_U32)pBuf, width, height, format, planes);
- *pStride = Exynos_OSAL_GetANBStride((OMX_U32)pBuf);
+ ret = Exynos_OSAL_LockANBHandle((OMX_U32)pBuf, width, height, format, pStride, planes);
}
EXIT:
{
int i = 0;
EXYNOS_OMX_REF_HANDLE *phREF = NULL;
+ gralloc_module_t *module = NULL;
+
OMX_ERRORTYPE err = OMX_ErrorNone;
FunctionIn();
phREF->SharedBuffer[i].BufferFd2 = -1;
}
+ hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+ phREF->pGrallocModule = (OMX_PTR)module;
+
err = Exynos_OSAL_MutexCreate(&phREF->hMutex);
if (err != OMX_ErrorNone) {
Exynos_OSAL_Free(phREF);
goto EXIT;
}
- hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+ module = (gralloc_module_t *)phREF->pGrallocModule;
Exynos_OSAL_MutexLock(phREF->hMutex);
for (i = 0; i < MAX_BUFFER_REF; i++) {
Exynos_OSAL_RefANB_Reset(phREF);
+ phREF->pGrallocModule = NULL;
+
ret = Exynos_OSAL_MutexTerminate(phREF->hMutex);
if (ret != OMX_ErrorNone)
goto EXIT;
{
int i;
OMX_ERRORTYPE ret = OMX_ErrorNone;
- buffer_handle_t bufferHandle = (buffer_handle_t) pBuffer;//pANB->handle;
+ buffer_handle_t bufferHandle = (buffer_handle_t) pBuffer; //pANB->handle
private_handle_t *priv_hnd = (private_handle_t *) bufferHandle;
EXYNOS_OMX_REF_HANDLE *phREF = (EXYNOS_OMX_REF_HANDLE *)hREF;
gralloc_module_t* module = NULL;
goto EXIT;
}
- hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+ module = (gralloc_module_t *)phREF->pGrallocModule;
Exynos_OSAL_MutexLock(phREF->hMutex);
goto EXIT;
}
+ module = (gralloc_module_t *)phREF->pGrallocModule;
+
Exynos_OSAL_MutexLock(phREF->hMutex);
- hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+
for (i = 0; i < MAX_BUFFER_REF; i++) {
if (phREF->SharedBuffer[i].BufferFd == BufferFd) {
- ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle);
- ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle1);
- ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle2);
+ if (phREF->SharedBuffer[i].BufferFd > -1)
+ ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle);
+ if (phREF->SharedBuffer[i].BufferFd1 > -1)
+ ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle1);
+ if (phREF->SharedBuffer[i].BufferFd2 > -1)
+ ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle2);
phREF->SharedBuffer[i].cnt--;
if (phREF->SharedBuffer[i].cnt == 0) {
phREF->SharedBuffer[i].BufferFd = -1;
pExynosPort->extendBufferHeader[i].OMXBufferHeader = temp_bufferHeader;
pExynosPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
- temp_bufferHeader->pBuffer = pBuffer;
+ android_native_buffer_t *pANB = (android_native_buffer_t *) pBuffer;
+ temp_bufferHeader->pBuffer = (OMX_U8 *)pANB->handle;
temp_bufferHeader->nAllocLen = nSizeBytes;
temp_bufferHeader->pAppPrivate = pAppPrivate;
if (nPortIndex == INPUT_PORT_INDEX)
width = pExynosPort->portDefinition.format.video.nFrameWidth;
height = pExynosPort->portDefinition.format.video.nFrameHeight;
- Exynos_OSAL_LockANB(temp_bufferHeader->pBuffer, width, height,
+ Exynos_OSAL_LockANBHandle((OMX_U32)temp_bufferHeader->pBuffer, width, height,
pExynosPort->portDefinition.format.video.eColorFormat,
&stride, planes);
pExynosPort->extendBufferHeader[i].buf_fd[0] = planes[0].fd;
pExynosPort->extendBufferHeader[i].pYUVBuf[1] = planes[1].addr;
pExynosPort->extendBufferHeader[i].buf_fd[2] = planes[2].fd;
pExynosPort->extendBufferHeader[i].pYUVBuf[2] = planes[2].addr;
- Exynos_OSAL_UnlockANB(temp_bufferHeader->pBuffer);
+ Exynos_OSAL_UnlockANBHandle((OMX_U32)temp_bufferHeader->pBuffer);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "useAndroidNativeBuffer: buf %d pYUVBuf[0]:0x%x (fd:%d), pYUVBuf[1]:0x%x (fd:%d)",
i, pExynosPort->extendBufferHeader[i].pYUVBuf[0], planes[0].fd,
pExynosPort->extendBufferHeader[i].pYUVBuf[1], planes[1].fd);
pExynosPort->bufferProcessType = BUFFER_SHARE;
pExynosPort->portDefinition.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatNV12Tiled;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_IndexParamEnableAndroidBuffers & bufferProcessType change to BUFFER_SHARE");
+ } else if ((portIndex == OUTPUT_PORT_INDEX) &&
+ (pExynosPort->bStoreMetaData == OMX_FALSE && pExynosPort->bIsANBEnabled == OMX_FALSE) &&
+ pExynosPort->bufferProcessType == BUFFER_SHARE) {
+ pExynosPort->bufferProcessType = (EXYNOS_OMX_BUFFERPROCESS_TYPE)(BUFFER_COPY | BUFFER_ANBSHARE);
+ pExynosPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "No OMX_IndexParamEnableAndroidBuffers => reset bufferProcessType");
}
}
break;
pExynosPort->bStoreMetaData = pANBParams->bStoreMetaData;
if (pExynosComponent->codecType == HW_VIDEO_ENC_CODEC) {
EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;;
- pVideoEnc->bFirstInput = OMX_TRUE;
} else if (pExynosComponent->codecType == HW_VIDEO_DEC_CODEC) {
EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle;;
if ((portIndex == OUTPUT_PORT_INDEX) &&
pExynosPort->bufferProcessType = BUFFER_SHARE;
pExynosPort->portDefinition.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatNV12Tiled;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_IndexParamStoreMetaDataBuffer & bufferProcessType change to BUFFER_SHARE");
+ } else if ((portIndex == OUTPUT_PORT_INDEX) &&
+ (pExynosPort->bStoreMetaData == OMX_FALSE && pExynosPort->bIsANBEnabled == OMX_FALSE) &&
+ pExynosPort->bufferProcessType == BUFFER_SHARE) {
+ pExynosPort->bufferProcessType = (EXYNOS_OMX_BUFFERPROCESS_TYPE)(BUFFER_COPY | BUFFER_ANBSHARE);
+ pExynosPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "No OMX_IndexParamStoreMetaDataBuffer => reset bufferProcessType");
}
}