From: Jeongmo Yang Date: Tue, 24 Sep 2019 08:07:06 +0000 (+0900) Subject: Add feature for tizen allocator X-Git-Tag: accepted/tizen/5.5/unified/20191031.004550^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_6.0_hotfix;p=platform%2Fadaptation%2Fap_samsung%2Flibomxil-e9110-v4l2.git Add feature for tizen allocator [Version] 0.0.2-4 [Profile] Common [Issue Type] Featuring Change-Id: I014a52767e9579021d75cb4d25efb9f75d2db25a Signed-off-by: Jeongmo Yang --- diff --git a/configure.ac b/configure.ac index b4528d6..2d81630 100755 --- a/configure.ac +++ b/configure.ac @@ -81,9 +81,23 @@ PKG_CHECK_MODULES(EXYNOSCOMMON,exynos-common) AC_SUBST(EXYNOSCOMMON_CFLAGS) AC_SUBST(EXYNOSCOMMON_LIBS) -PKG_CHECK_MODULES(TBM, libtbm) -AC_SUBST(TBM_CFLAGS) -AC_SUBST(TBM_LIBS) +dnl Tizen allocator(since 5.0) +AC_ARG_ENABLE([tizen-allocator], AC_HELP_STRING([--enable-tizen-allocator], [Enable tizen allocator specific code]), + [ + case "${enableval}" in + yes) TIZEN_ALLOCATOR=yes ;; + no) TIZEN_ALLOCATOR=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-tizen-allocator) ;; + esac + ], + [TIZEN_ALLOCATOR=no]) +if test "x$TIZEN_ALLOCATOR" = "xyes"; then + PKG_CHECK_MODULES(TBM, libtbm) + AC_SUBST(TBM_CFLAGS) + AC_SUBST(TBM_LIBS) +fi +AM_CONDITIONAL([TIZEN_ALLOCATOR], [test "x$TIZEN_ALLOCATOR" = "xyes"]) + dnl use dlog ------------------------------------------------------------------ AC_ARG_ENABLE(dlog, AC_HELP_STRING([--enable-dlog], [using dlog]), diff --git a/openmax/osal/Exynos_OSAL_Tizen.c b/openmax/osal/Exynos_OSAL_Tizen.c index d959bc1..4aecf3c 100755 --- a/openmax/osal/Exynos_OSAL_Tizen.c +++ b/openmax/osal/Exynos_OSAL_Tizen.c @@ -36,9 +36,13 @@ #include "ExynosVideoApi.h" +#ifdef TIZEN_FEATURE_TIZEN_ALLOCATOR #include #include #include +#else +#include +#endif #undef EXYNOS_LOG_TAG #define EXYNOS_LOG_TAG "Exynos_OSAL_Tizen" @@ -161,8 +165,12 @@ OMX_ERRORTYPE Exynos_OSAL_GetParameter( EXYNOS_OMX_BASEPORT *pExynosPort = &pExynosComponent->pExynosPort[pPortDef->nPortIndex]; if (pExynosPort->eMetaDataType == METADATA_TYPE_DATA) +#ifdef TIZEN_FEATURE_TIZEN_ALLOCATOR pPortDef->nBufferSize = (ALIGN(pExynosPort->portDefinition.format.video.nFrameWidth, 16) * ALIGN(pExynosPort->portDefinition.format.video.nFrameHeight, 16) * 3) / 2; +#else + pPortDef->nBufferSize = sizeof(MMVideoBuffer); +#endif } break; default: @@ -361,8 +369,13 @@ OMX_ERRORTYPE Exynos_OSAL_GetInfoFromMetaData( OMX_IN EXYNOS_METADATA_TYPE eMetaDataType) { OMX_ERRORTYPE ret = OMX_ErrorNone; +#ifdef TIZEN_FEATURE_TIZEN_ALLOCATOR tbm_surface_h surface; tbm_bo bo[2]; +#else + MMVideoBuffer *pMetaBuffer = NULL; +#endif + int i; FunctionIn(); @@ -376,6 +389,7 @@ OMX_ERRORTYPE Exynos_OSAL_GetInfoFromMetaData( } if (eMetaDataType == METADATA_TYPE_DATA) { +#ifdef TIZEN_FEATURE_TIZEN_ALLOCATOR surface = (tbm_surface_h)pBuffer; bo[0] = tbm_surface_internal_get_bo(surface, 0); @@ -384,6 +398,13 @@ OMX_ERRORTYPE Exynos_OSAL_GetInfoFromMetaData( for (i = 0; i < 2; i++) { pBufferInfo->fd[i] = (unsigned long)(tbm_bo_get_handle (bo[i], TBM_DEVICE_MM).u32); pBufferInfo->addr[i] = (OMX_PTR)(tbm_bo_get_handle (bo[i], TBM_DEVICE_CPU).ptr); +#else + pMetaBuffer = (MMVideoBuffer *)pBuffer; + + for (i = 0; i < pMetaBuffer->plane_num; i++) { + pBufferInfo->fd[i] = (unsigned long)(pMetaBuffer->handle.dmabuf_fd[i]); + pBufferInfo->addr[i] = (OMX_PTR)(pMetaBuffer->data[i]); +#endif Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%s] Plane[%d]: FD(%u), VA(%p)", __FUNCTION__, i, pBufferInfo->fd[i], pBufferInfo->addr[i]); @@ -436,8 +457,11 @@ OMX_PTR Exynos_OSAL_AllocMetaDataBuffer( FunctionIn(); if (eMetaDataType == METADATA_TYPE_DATA) { +#ifdef TIZEN_FEATURE_TIZEN_ALLOCATOR pBuffer = Exynos_OSAL_Malloc(sizeof(tbm_surface_h)); - +#else + pBuffer = Exynos_OSAL_Malloc(sizeof(MMVideoBuffer)); +#endif if (pBuffer == NULL) { Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] Failed to allocate metadata buffer", __FUNCTION__); goto EXIT; diff --git a/openmax/osal/Makefile.am b/openmax/osal/Makefile.am index ba32311..fd73153 100755 --- a/openmax/osal/Makefile.am +++ b/openmax/osal/Makefile.am @@ -12,8 +12,10 @@ libExynosOMX_OSAL_la_SOURCES = Exynos_OSAL_Event.c \ Exynos_OSAL_Tizen.c \ Exynos_OSAL_SharedMemory.c -libExynosOMX_OSAL_la_LIBADD = $(top_builddir)/exynos/libvideocodec/libExynosVideoApi.la \ - $(TBM_LIBS) +libExynosOMX_OSAL_la_LIBADD = $(top_builddir)/exynos/libvideocodec/libExynosVideoApi.la +if TIZEN_ALLOCATOR +libExynosOMX_OSAL_la_LIBADD += $(TBM_LIBS) +endif libExynosOMX_OSAL_la_CFLAGS = -I$(top_srcdir)/openmax/include/khronos \ -I$(top_srcdir)/openmax/include/exynos \ @@ -28,3 +30,8 @@ if USE_DLOG libExynosOMX_OSAL_la_CFLAGS += $(DLOG_CFLAGS) -DUSE_DLOG libExynosOMX_OSAL_la_LIBADD += $(DLOG_LIBS) endif + +if TIZEN_ALLOCATOR +libExynosOMX_OSAL_la_CFLAGS += $(TBM_CFLAGS) -DTIZEN_FEATURE_TIZEN_ALLOCATOR +endif + diff --git a/packaging/libomxil-e9110-v4l2.spec b/packaging/libomxil-e9110-v4l2.spec index 02d4a5c..cb4c6e3 100755 --- a/packaging/libomxil-e9110-v4l2.spec +++ b/packaging/libomxil-e9110-v4l2.spec @@ -3,7 +3,7 @@ Summary: OpenMAX IL for e9110-v4l2 Version: 0.0.2 License: Apache-2.0 Group: Development/Libraries -Release: 3 +Release: 4 ExclusiveArch: %arm Source: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig @@ -37,7 +37,7 @@ export CFLAGS+=" -mfpu=neon\ -DGST_EXT_TIME_ANALYSIS" LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--hash-style=both -Wl,--as-needed"; export LDFLAGS -%configure --prefix=%{_prefix} --disable-static --enable-dlog --enable-exynos9110 +%configure --prefix=%{_prefix} --disable-static --enable-dlog --enable-exynos9110 --enable-tizen-allocator #make %{?jobs:-j%jobs} make