osal: Fix OSAL lock anb type casting
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Mon, 30 Mar 2015 16:12:37 +0000 (18:12 +0200)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Tue, 31 Mar 2015 17:19:13 +0000 (17:19 +0000)
Backported-from: hardware/samsung_slsi/exynos5

Change-Id: Ifc8cfeaa247be26bc673fc51ef501f81ed8dc8f7
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
component/video/dec/Exynos_OMX_Vdec.c
component/video/dec/Exynos_OMX_VdecControl.c
component/video/enc/Exynos_OMX_Venc.c
component/video/enc/Exynos_OMX_VencControl.c
osal/Exynos_OSAL_Android.cpp
osal/Exynos_OSAL_Android.h

index cb32d85d06c6b49ef0cd952a649ab3bf21869a30..154f8142ea7d5a4797ea7a8ae241284e23f01ffd 100644 (file)
@@ -375,7 +375,7 @@ OMX_BOOL Exynos_CSC_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
 
 #ifdef USE_ANB
     if (exynosOutputPort->bIsANBEnabled == OMX_TRUE) {
-        Exynos_OSAL_LockANB(pOutputBuf, nImageWidth, nImageHeight, eColorFormat, &stride, planes);
+        Exynos_OSAL_LockANBHandle(pOutputBuf, nImageWidth, nImageHeight, eColorFormat, &stride, planes);
         nImageWidth = stride;
         outputUseBuffer->dataLen = sizeof(void *);
 
@@ -489,7 +489,7 @@ OMX_BOOL Exynos_CSC_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
 
 #ifdef USE_ANB
     if (exynosOutputPort->bIsANBEnabled == OMX_TRUE) {
-        Exynos_OSAL_UnlockANB(pOutputBuf);
+        Exynos_OSAL_UnlockANBHandle(pOutputBuf);
     }
 #endif
 
index c29666ffa197ba2e9bb08a39fec71f19c89791cd..d2b2647fe27235131b453a6431106029cf9616d3 100644 (file)
@@ -474,7 +474,7 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 por
                 } else if (portIndex == OUTPUT_PORT_INDEX) {
 #ifdef USE_ANB
                     if (pExynosPort->bIsANBEnabled == OMX_TRUE)
-                        Exynos_OSAL_UnlockANB(pExynosPort->processData.bufferHeader->pBuffer);
+                        Exynos_OSAL_UnlockANBHandle((OMX_U32)pExynosPort->processData.bufferHeader->pBuffer);
 #endif
                     Exynos_OMX_OutputBufferReturn(pOMXComponent, pExynosPort->processData.bufferHeader);
                 }
@@ -487,7 +487,7 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 por
                     if (portIndex == OUTPUT_PORT_INDEX) {
 #ifdef USE_ANB
                         if (pExynosPort->bIsANBEnabled == OMX_TRUE)
-                            Exynos_OSAL_UnlockANB(pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer);
+                            Exynos_OSAL_UnlockANBHandle((OMX_U32)pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer);
 #endif
                         Exynos_OMX_OutputBufferReturn(pOMXComponent, pExynosPort->extendBufferHeader[i].OMXBufferHeader);
                     } else if (portIndex == INPUT_PORT_INDEX) {
@@ -1625,7 +1625,7 @@ OMX_ERRORTYPE Exynos_Shared_ANBBufferToData(EXYNOS_OMX_DATABUFFER *pUseBuffer, E
         if ((pUseBuffer->bufferHeader != NULL) &&
             (pUseBuffer->bufferHeader->pBuffer != NULL) &&
             (pExynosPort->exceptionFlag == GENERAL_STATE)) {
-            Exynos_OSAL_LockANB(pUseBuffer->bufferHeader->pBuffer, width, height, pExynosPort->portDefinition.format.video.eColorFormat, &stride, planes);
+            Exynos_OSAL_LockANBHandle(pUseBuffer->bufferHeader->pBuffer, width, height, pExynosPort->portDefinition.format.video.eColorFormat, &stride, planes);
             pUseBuffer->dataLen = sizeof(void *);
         } else {
             ret = OMX_ErrorBadParameter;
@@ -1684,7 +1684,7 @@ OMX_ERRORTYPE Exynos_Shared_DataToANBBuffer(EXYNOS_OMX_DATA *pData, EXYNOS_OMX_D
     }
 
     if (pExynosPort->bIsANBEnabled == OMX_TRUE) {
-        Exynos_OSAL_UnlockANB(pUseBuffer->bufferHeader->pBuffer);
+        Exynos_OSAL_UnlockANBHandle((OMX_U32)pUseBuffer->bufferHeader->pBuffer);
     } else {
         Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s : %d", __FUNCTION__, __LINE__);
         ret = OMX_ErrorBadParameter;
index 919a8b4f94368e485f5885fa5220c7cd346edebd..66f6a3211509a2e71a05f95215949bba9a6fe34b 100644 (file)
@@ -322,6 +322,7 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
         /* kMetadataBufferTypeGrallocSource */
         /* ARGB8888 converted to YUV420SemiPlanar */
         ExynosVideoPlane planes[MAX_BUFFER_PLANE];
+        OMX_U32 stride;
 
         csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_Format32bitARGB8888);
         csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
@@ -337,7 +338,7 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
             codecInputBuffer->dataSize += nPlaneSize[i];
 
         csc_src_color_format  = omx_2_hal_pixel_format((unsigned int)pVideoEnc->ANBColorFormat);
-        if (OMX_ErrorNone != Exynos_OSAL_LockANBHandle((OMX_U32)ppBuf[0], nFrameWidth, nFrameHeight, OMX_COLOR_FormatAndroidOpaque, planes)) {
+        if (OMX_ErrorNone != Exynos_OSAL_LockANBHandle((OMX_U32)ppBuf[0], nFrameWidth, nFrameHeight, OMX_COLOR_FormatAndroidOpaque, &stride, planes)) {
             Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OSAL_LockANBHandle() failed", __FUNCTION__);
             ret = OMX_FALSE;
             goto EXIT;
@@ -570,8 +571,9 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_
 #ifdef USE_DMA_BUF
                     if (eColorFormat == OMX_COLOR_FormatAndroidOpaque) {
                         ExynosVideoPlane planes[MAX_BUFFER_PLANE];
+                        OMX_U32 stride;
 
-                        Exynos_OSAL_LockANBHandle((OMX_U32)ppBuf[0], nFrameWidth, nFrameHeight, OMX_COLOR_FormatAndroidOpaque, planes);
+                        Exynos_OSAL_LockANBHandle((OMX_U32)ppBuf[0], nFrameWidth, nFrameHeight, OMX_COLOR_FormatAndroidOpaque, &stride, planes);
 
                         for (plane = 0; plane < exynosInputPort->nPlaneCnt; plane++) {
                             srcInputData->buffer.multiPlaneBuffer.fd[plane]         = planes[plane].fd;
index 81b950245c89e09832c97bf8b4d046a690eab422..7d9806a54f4d25b9c7b606c8212774b12c8bb554 100644 (file)
@@ -524,7 +524,7 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort(
                         OMX_PTR ppBuf[MAX_BUFFER_PLANE];
                         if (OMX_ErrorNone ==
                             Exynos_OSAL_GetInfoFromMetaData((OMX_BYTE)pExynosPort->processData.bufferHeader->pBuffer, ppBuf))
-                            Exynos_OSAL_UnlockANBHandle(ppBuf[0]);
+                            Exynos_OSAL_UnlockANBHandle((OMX_U32)ppBuf[0]);
                     }
 #endif
                     Exynos_OMX_InputBufferReturn(pOMXComponent, pExynosPort->processData.bufferHeader);
@@ -546,7 +546,7 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort(
                             OMX_PTR ppBuf[MAX_BUFFER_PLANE];
                             if (OMX_ErrorNone ==
                                 Exynos_OSAL_GetInfoFromMetaData((OMX_BYTE)pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer, ppBuf))
-                                Exynos_OSAL_UnlockANBHandle(ppBuf[0]);
+                                Exynos_OSAL_UnlockANBHandle((OMX_U32)ppBuf[0]);
                         }
 #endif
                         Exynos_OMX_InputBufferReturn(pOMXComponent,
@@ -1936,7 +1936,7 @@ OMX_ERRORTYPE Exynos_Shared_DataToBuffer(EXYNOS_OMX_DATA *pData, EXYNOS_OMX_DATA
         OMX_PTR ppBuf[MAX_BUFFER_PLANE];
         if (OMX_ErrorNone ==
             Exynos_OSAL_GetInfoFromMetaData((OMX_BYTE)pUseBuffer->bufferHeader->pBuffer, ppBuf))
-            Exynos_OSAL_UnlockANBHandle(ppBuf[0]);
+            Exynos_OSAL_UnlockANBHandle((OMX_U32)ppBuf[0]);
     }
 
     return ret;
index c87068b9bf9b481a90c665c48cfd840aa1cb4701..8a8a86cd51dd9531f59dc4f4182517323c28ea88 100644 (file)
@@ -68,6 +68,7 @@ OMX_ERRORTYPE Exynos_OSAL_LockANBHandle(
     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();
@@ -128,6 +129,8 @@ OMX_ERRORTYPE Exynos_OSAL_LockANBHandle(
     vplanes[1].addr = vaddr[1];
     vplanes[2].addr = vaddr[2];
 
+    *pStride = priv_hnd->stride;
+
     Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%s: buffer locked: 0x%x", __func__, *vaddr);
 
 EXIT:
@@ -178,43 +181,6 @@ EXIT:
     return ret;
 }
 
-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 useAndroidNativeBuffer(
     EXYNOS_OMX_BASEPORT      *pExynosPort,
     OMX_BUFFERHEADERTYPE **ppBufferHdr,
@@ -254,6 +220,8 @@ OMX_ERRORTYPE useAndroidNativeBuffer(
 
     for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) {
         if (pExynosPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            OMX_U32 stride;
+
             pExynosPort->extendBufferHeader[i].OMXBufferHeader = temp_bufferHeader;
             pExynosPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
             INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
@@ -267,7 +235,7 @@ OMX_ERRORTYPE useAndroidNativeBuffer(
 
             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);
 #ifdef USE_DMA_BUF
@@ -278,7 +246,7 @@ OMX_ERRORTYPE useAndroidNativeBuffer(
             pExynosPort->extendBufferHeader[i].pYUVBuf[0] = planes[0].addr;
             pExynosPort->extendBufferHeader[i].pYUVBuf[1] = planes[1].addr;
             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 , pYUVBuf[1]:0x%x ",
                             i, pExynosPort->extendBufferHeader[i].pYUVBuf[0],
                             pExynosPort->extendBufferHeader[i].pYUVBuf[1]);
index a0c21fbd8d1b20e5f4b5e6d5562f428d3544fe5c..db6a3bb9e19e5bb41ced0bb32664efbf8fe72582 100644 (file)
@@ -47,19 +47,11 @@ OMX_ERRORTYPE Exynos_OSAL_SetANBParameter(OMX_IN OMX_HANDLETYPE hComponent,
 
 OMX_COLOR_FORMATTYPE Exynos_OSAL_GetANBColorFormat(OMX_IN OMX_U32 handle);
 
-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);
-
-OMX_ERRORTYPE Exynos_OSAL_UnlockANB(OMX_IN OMX_PTR pBuffer);
-
 OMX_ERRORTYPE Exynos_OSAL_LockANBHandle(OMX_IN OMX_U32 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);
 
 OMX_ERRORTYPE Exynos_OSAL_UnlockANBHandle(OMX_IN OMX_U32 pBuffer);