video: added OMX_IndexVendorNeedContigMemory support
authorTaehwan Kim <t_h.kim@samsung.com>
Thu, 3 Jan 2013 09:12:54 +0000 (09:12 +0000)
committerTaehwan Kim <t_h.kim@samsung.com>
Thu, 17 Jan 2013 10:09:57 +0000 (10:09 +0000)
in order to set to allocate physically contig. buffer,
added OMX_IndexVendorNeedContigMemory support.

Change-Id: I27660a4b135d6c27c9eedd749cd2665157d72e70
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
component/video/dec/Exynos_OMX_VdecControl.c
component/video/enc/Exynos_OMX_VencControl.c
include/exynos/Exynos_OMX_Def.h

index f1454b8c0e0c4551c2617b9e2c0ca5a9f6644278..7f814ce8a2bac295f934de7967605275a71c521f 100644 (file)
@@ -197,6 +197,8 @@ OMX_ERRORTYPE Exynos_OMX_AllocateBuffer(
     if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) &&
         (nPortIndex == INPUT_PORT_INDEX)) {
         mem_type = SECURE_MEMORY;
+    } else if (pExynosPort->bNeedContigMem == OMX_TRUE) {
+        mem_type = CONTIG_MEMORY;
     } else if ((nPortIndex == OUTPUT_PORT_INDEX) &&
                (pExynosPort->bufferProcessType & BUFFER_SHARE)) {
         mem_type = NORMAL_MEMORY;
@@ -1072,6 +1074,26 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetParameter(
     }
         break;
 #endif
+    case OMX_IndexVendorNeedContigMemory:
+    {
+        EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE  *pPortMemType    = (EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE *)ComponentParameterStructure;
+        OMX_U32                              nPortIndex      = pPortMemType->nPortIndex;
+        EXYNOS_OMX_BASEPORT                 *pExynosPort;
+
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        ret = Exynos_OMX_Check_SizeVersion(pPortMemType, sizeof(EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
+
+        pPortMemType->bNeedContigMem = pExynosPort->bNeedContigMem;
+    }
+        break;
     default:
     {
         ret = Exynos_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
@@ -1239,6 +1261,33 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter(
     }
         break;
 #endif
+    case OMX_IndexVendorNeedContigMemory:
+    {
+        EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE  *pPortMemType    = (EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE *)ComponentParameterStructure;
+        OMX_U32                              nPortIndex      = pPortMemType->nPortIndex;
+        EXYNOS_OMX_BASEPORT                 *pExynosPort;
+
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        ret = Exynos_OMX_Check_SizeVersion(pPortMemType, sizeof(EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
+
+        if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) {
+            if (pExynosPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+
+        pExynosPort->bNeedContigMem = pPortMemType->bNeedContigMem;
+    }
+        break;
     default:
     {
         ret = Exynos_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
@@ -1388,6 +1437,12 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetExtensionIndex(
         goto EXIT;
     }
 
+    if (Exynos_OSAL_Strcmp(cParameterName, EXYNOS_INDEX_PARAM_NEED_CONTIG_MEMORY) == 0) {
+        *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorNeedContigMemory;
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
 #ifdef USE_ANB
     if (Exynos_OSAL_Strcmp(cParameterName, EXYNOS_INDEX_PARAM_ENABLE_ANB) == 0)
         *pIndexType = (OMX_INDEXTYPE) OMX_IndexParamEnableAndroidBuffers;
index 89dd29210f9d5d85c326c345885e589b460602c2..2dd1b11baefacd4523a9170026d33e54947c4a01 100644 (file)
@@ -200,7 +200,9 @@ OMX_ERRORTYPE Exynos_OMX_AllocateBuffer(
         goto EXIT;
     }
 
-    if ((nPortIndex == INPUT_PORT_INDEX) &&
+    if (pExynosPort->bNeedContigMem == OMX_TRUE) {
+        eMemType = CONTIG_MEMORY;
+    } else if ((nPortIndex == INPUT_PORT_INDEX) &&
         (pExynosPort->bufferProcessType & BUFFER_SHARE)) {
         eMemType = NORMAL_MEMORY;
     }
@@ -1407,6 +1409,26 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
             pPortDef->nBufferSize = MAX_INPUT_METADATA_BUFFER_SIZE;
         }
 #endif
+    }
+        break;
+    case OMX_IndexVendorNeedContigMemory:
+    {
+        EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE  *pPortMemType    = (EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE *)pComponentParameterStructure;
+        OMX_U32                              nPortIndex      = pPortMemType->nPortIndex;
+        EXYNOS_OMX_BASEPORT                 *pExynosPort;
+
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        ret = Exynos_OMX_Check_SizeVersion(pPortMemType, sizeof(EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
+
+        pPortMemType->bNeedContigMem = pExynosPort->bNeedContigMem;
     }
         break;
     default:
@@ -1594,6 +1616,33 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
     }
         break;
 #endif
+    case OMX_IndexVendorNeedContigMemory:
+    {
+        EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE  *pPortMemType    = (EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE *)pComponentParameterStructure;
+        OMX_U32                              nPortIndex      = pPortMemType->nPortIndex;
+        EXYNOS_OMX_BASEPORT                 *pExynosPort;
+
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        ret = Exynos_OMX_Check_SizeVersion(pPortMemType, sizeof(EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
+
+        if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) {
+            if (pExynosPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+
+        pExynosPort->bNeedContigMem = pPortMemType->bNeedContigMem;
+    }
+        break;
     default:
     {
         ret = Exynos_OMX_SetParameter(hComponent, nParamIndex, pComponentParameterStructure);
@@ -1818,6 +1867,12 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetExtensionIndex(
         goto EXIT;
     }
 
+    if (Exynos_OSAL_Strcmp(szParamName, EXYNOS_INDEX_PARAM_NEED_CONTIG_MEMORY) == 0) {
+        *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorNeedContigMemory;
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
 #ifdef USE_STOREMETADATA
     if (Exynos_OSAL_Strcmp(szParamName, EXYNOS_INDEX_PARAM_STORE_METADATA_BUFFER) == 0) {
         *pIndexType = (OMX_INDEXTYPE)OMX_IndexParamStoreMetaDataBuffer;
index a6873a416003e83c989f73e17959ee481af32a92..3877da28a574b8f631ed5e660a49395121f73388 100644 (file)
@@ -66,6 +66,13 @@ typedef struct _EXYNOS_OMX_PRIORITYMGMTTYPE
     OMX_U32 nGroupID;
 } EXYNOS_OMX_PRIORITYMGMTTYPE;
 
+typedef struct _EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE {
+    OMX_U32         nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32         nPortIndex;
+    OMX_BOOL        bNeedContigMem;
+} EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE;
+
 typedef enum _EXYNOS_OMX_INDEXTYPE
 {
 #define EXYNOS_INDEX_PARAM_ENABLE_THUMBNAIL "OMX.SEC.index.ThumbnailMode"
@@ -76,6 +83,8 @@ typedef enum _EXYNOS_OMX_INDEXTYPE
 #define EXYNOS_INDEX_PARAM_GET_S3D "OMX.SEC.index.S3DMode"
     OMX_IndexVendorS3DMode                  = 0x7F000003,
 #endif
+#define EXYNOS_INDEX_PARAM_NEED_CONTIG_MEMORY "OMX.SEC.index.NeedContigMemory"
+    OMX_IndexVendorNeedContigMemory         = 0x7F000004,
 
     /* for Android Native Window */
 #define EXYNOS_INDEX_PARAM_ENABLE_ANB "OMX.google.android.index.enableAndroidNativeBuffers"