summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdomx/domx/omx_proxy_common.h1
-rwxr-xr-xdomx/domx/omx_rpc/src/omx_rpc.c20
-rwxr-xr-xdomx/omx_core/src/OMX_Core.c12
-rw-r--r--domx/omx_proxy_component/Android.mk31
-rwxr-xr-xdomx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec.c18
-rw-r--r--domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec_secure.c84
-rw-r--r--omap4.mk1
7 files changed, 154 insertions, 13 deletions
diff --git a/domx/domx/omx_proxy_common.h b/domx/domx/omx_proxy_common.h
index 638cbc5..8eb21e5 100755
--- a/domx/domx/omx_proxy_common.h
+++ b/domx/domx/omx_proxy_common.h
@@ -207,6 +207,7 @@ extern "C"
OMX_BOOL bUseIon;
OMX_BOOL bMapIonBuffers;
#endif
+ int secure_misc_drv_fd;
} PROXY_COMPONENT_PRIVATE;
diff --git a/domx/domx/omx_rpc/src/omx_rpc.c b/domx/domx/omx_rpc/src/omx_rpc.c
index ff1022b..d93134c 100755
--- a/domx/domx/omx_rpc/src/omx_rpc.c
+++ b/domx/domx/omx_rpc/src/omx_rpc.c
@@ -108,7 +108,7 @@ RPC_OMX_ERRORTYPE RPC_InstanceInit(OMX_STRING cComponentName,
OMX_S32 status = 0;
struct omx_conn_req sReq = { .name = "OMX" };
TIMM_OSAL_ERRORTYPE eError = TIMM_OSAL_ERR_NONE;
- OMX_U32 i = 0;
+ OMX_U32 i = 0, nAttempts = 0;
*(RPC_OMX_CONTEXT **) phRPCCtx = NULL;
@@ -126,9 +126,21 @@ RPC_OMX_ERRORTYPE RPC_InstanceInit(OMX_STRING cComponentName,
/*Assuming that open maintains an internal count for multi instance */
DOMX_DEBUG("Calling open on the device");
- pRPCCtx->fd_omx = open("/dev/rpmsg-omx1", O_RDWR);
- RPC_assert(pRPCCtx->fd_omx >= 0, RPC_OMX_ErrorInsufficientResources,
- "Can't open device");
+ while (1)
+ {
+ pRPCCtx->fd_omx = open("/dev/rpmsg-omx1", O_RDWR);
+ if(pRPCCtx->fd_omx >= 0 || errno != ENOENT || nAttempts == 15)
+ break;
+ DOMX_DEBUG("errno from open= %d, REATTEMPTING OPEN!!!!",errno);
+ nAttempts++;
+ usleep(1000000);
+ }
+ if(pRPCCtx->fd_omx < 0)
+ {
+ DOMX_ERROR("Can't open device, errorno from open = %d",errno);
+ eError = RPC_OMX_ErrorInsufficientResources;
+ goto EXIT;
+ }
DOMX_DEBUG("Open was successful, pRPCCtx->fd_omx = %d",
pRPCCtx->fd_omx);
//AD
diff --git a/domx/omx_core/src/OMX_Core.c b/domx/omx_core/src/OMX_Core.c
index fc439db..8c2fb15 100755
--- a/domx/omx_core/src/OMX_Core.c
+++ b/domx/omx_core/src/OMX_Core.c
@@ -113,6 +113,8 @@ extern OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent);
goto EXIT; }\
} while(0)
+OMX_U32 DUCATI_IN_SECURE_MODE = 0;
+OMX_U32 SECURE_COMPONENTS_RUNNING = 0;
/******************************Public*Routine******************************\
* OMX_Init()
@@ -228,6 +230,16 @@ OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE * pHandle,
strcpy(buf, prefix); /* the lengths are defined herein or have been */
strcat(buf, cComponentName); /* checked already, so strcpy and strcat are */
strcat(buf, postfix); /* are safe to use in this context. */
+
+ if(DUCATI_IN_SECURE_MODE == 1)
+ {
+ if(strstr(cComponentName,"secure") == NULL)
+ {
+ TIMM_OSAL_Error("non-secure component not supported in secure mode");
+ eError = OMX_ErrorComponentNotFound;
+ goto EXIT;
+ }
+ }
//#if 0
pModules[i] = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
if (pModules[i] == NULL)
diff --git a/domx/omx_proxy_component/Android.mk b/domx/omx_proxy_component/Android.mk
index fede237..4ebd727 100644
--- a/domx/omx_proxy_component/Android.mk
+++ b/domx/omx_proxy_component/Android.mk
@@ -159,3 +159,34 @@ LOCAL_SRC_FILES:= omx_mpeg4_enc/src/omx_proxy_mpeg4enc.c
LOCAL_MODULE:= libOMX.TI.DUCATI1.VIDEO.MPEG4E
include $(BUILD_HEAPTRACKED_SHARED_LIBRARY)
+#
+# libOMX.TI.DUCATI1.VIDEO.DECODER.secure
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/../omx_core/inc \
+ $(LOCAL_PATH)/../mm_osal/inc \
+ $(LOCAL_PATH)/../domx \
+ $(LOCAL_PATH)/../domx/omx_rpc/inc \
+ $(HARDWARE_TI_OMAP4_BASE)/../../libhardware/include \
+ $(HARDWARE_TI_OMAP4_BASE)/hwc/
+
+LOCAL_SHARED_LIBRARIES := \
+ libmm_osal \
+ libc \
+ libOMX_Core \
+ liblog \
+ libdomx \
+ libhardware \
+ libOMX.TI.DUCATI1.VIDEO.DECODER
+
+LOCAL_CFLAGS += -DLINUX -DTMS32060 -D_DB_TIOMAP -DSYSLINK_USE_SYSMGR -DSYSLINK_USE_LOADER
+LOCAL_CFLAGS += -D_Android -DSET_STRIDE_PADDING_FROM_PROXY -DANDROID_QUIRK_CHANGE_PORT_VALUES -DUSE_ENHANCED_PORTRECONFIG
+LOCAL_CFLAGS += -DANDROID_QUIRK_LOCK_BUFFER -DUSE_ION -DENABLE_GRALLOC_BUFFERS
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= omx_video_dec/src/omx_proxy_videodec_secure.c
+LOCAL_MODULE:= libOMX.TI.DUCATI1.VIDEO.DECODER.secure
+include $(BUILD_HEAPTRACKED_SHARED_LIBRARY)
diff --git a/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec.c b/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec.c
index 81e593e..5c5a4b9 100755
--- a/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec.c
+++ b/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec.c
@@ -151,13 +151,6 @@ OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent)
OMX_ErrorInsufficientResources,
" Error in Allocating space for proxy component table");
- // Copying component Name - this will be picked up in the proxy common
- PROXY_assert(strlen(COMPONENT_NAME) + 1 < MAX_COMPONENT_NAME_LENGTH,
- OMX_ErrorInvalidComponentName,
- "Length of component name is longer than the max allowed");
- TIMM_OSAL_Memcpy(pComponentPrivate->cCompName, COMPONENT_NAME,
- strlen(COMPONENT_NAME) + 1);
-
eError = OMX_ProxyViddecInit(hComponent);
EXIT:
@@ -180,8 +173,15 @@ OMX_ERRORTYPE OMX_ProxyViddecInit(OMX_HANDLETYPE hComponent)
DOMX_DEBUG("Component name provided is %s", COMPONENT_NAME);
- pComponentPrivate =
- (PROXY_COMPONENT_PRIVATE *) pHandle->pComponentPrivate;
+ pComponentPrivate =
+ (PROXY_COMPONENT_PRIVATE *) pHandle->pComponentPrivate;
+
+ // Copying component Name - this will be picked up in the proxy common
+ PROXY_assert(strlen(COMPONENT_NAME) + 1 < MAX_COMPONENT_NAME_LENGTH,
+ OMX_ErrorInvalidComponentName,
+ "Length of component name is longer than the max allowed");
+ TIMM_OSAL_Memcpy(pComponentPrivate->cCompName, COMPONENT_NAME,
+ strlen(COMPONENT_NAME) + 1);
eError = OMX_ProxyCommonInit(hComponent); // Calling Proxy Common Init()
PROXY_assert(eError == OMX_ErrorNone, eError, "Proxy common init returned error");
diff --git a/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec_secure.c b/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec_secure.c
index 616d699..f0db1f5 100644
--- a/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec_secure.c
+++ b/domx/omx_proxy_component/omx_video_dec/src/omx_proxy_videodec_secure.c
@@ -3,14 +3,27 @@
#include <assert.h>
#include "omx_proxy_common.h"
#include <timm_osal_interfaces.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#define COMPONENT_NAME "OMX.TI.DUCATI1.VIDEO.DECODER.secure"
+extern OMX_U32 DUCATI_IN_SECURE_MODE;
+extern OMX_U32 SECURE_COMPONENTS_RUNNING;
+
+extern OMX_ERRORTYPE OMX_ProxyViddecInit(OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE PROXY_VIDDEC_Secure_ComponentDeInit(OMX_HANDLETYPE hComponent);
+
OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent)
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_COMPONENTTYPE *pHandle = NULL;
PROXY_COMPONENT_PRIVATE *pComponentPrivate = NULL;
+ OMX_U8 enable = 1, mode;
+ int ret;
+
pHandle = (OMX_COMPONENTTYPE *) hComponent;
DOMX_ENTER("");
@@ -47,7 +60,33 @@ OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent)
TIMM_OSAL_Memcpy(pComponentPrivate->cCompName, COMPONENT_NAME,
strlen(COMPONENT_NAME) + 1);
+ if(DUCATI_IN_SECURE_MODE == 0)
+ {
+ DUCATI_IN_SECURE_MODE = 1;
+ pComponentPrivate->secure_misc_drv_fd = open("/dev/rproc_user", O_SYNC | O_RDWR);
+ if (pComponentPrivate->secure_misc_drv_fd < 0)
+ {
+ DOMX_ERROR("Can't open rproc_user device 0x%x\n", errno);
+ return OMX_ErrorInsufficientResources;
+ }
+
+ ret = write(pComponentPrivate->secure_misc_drv_fd, &enable, sizeof(enable));
+ if(ret != 1)
+ {
+ DOMX_ERROR("errno from setting secure mode = %x",errno);
+ }
+ PROXY_assert(ret == 1, OMX_ErrorUndefined,"ERROR: Unable to set secure mode");
+ DOMX_DEBUG("ret value from Misc driver for secure playback = 0x%x\n", ret);
+
+ ret = read(pComponentPrivate->secure_misc_drv_fd, &mode, sizeof(mode));
+ PROXY_assert(mode == enable, OMX_ErrorUndefined,"ERROR: We are not in secure mode");
+ DOMX_DEBUG("secure mode recieved from Misc driver for secure playback = 0x%x\n", mode);
+ }
+
+ SECURE_COMPONENTS_RUNNING++;
+
eError = OMX_ProxyViddecInit(hComponent);
+ pHandle->ComponentDeInit = PROXY_VIDDEC_Secure_ComponentDeInit;
#ifdef USE_ION
pComponentPrivate->bUseIon = OMX_TRUE;
@@ -56,3 +95,48 @@ OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent)
EXIT:
return eError;
}
+
+OMX_ERRORTYPE PROXY_VIDDEC_Secure_ComponentDeInit(OMX_HANDLETYPE hComponent)
+{
+ OMX_ERRORTYPE eError = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pHandle = NULL;
+ PROXY_COMPONENT_PRIVATE *pComponentPrivate = NULL;
+ int ret;
+ OMX_U8 disable = 0;
+ int secure_misc_drv_fd;
+
+ pHandle = (OMX_COMPONENTTYPE *) hComponent;
+
+ pComponentPrivate =
+ (PROXY_COMPONENT_PRIVATE *) pHandle->pComponentPrivate;
+
+ secure_misc_drv_fd = pComponentPrivate->secure_misc_drv_fd;
+
+ eError = PROXY_ComponentDeInit(hComponent);
+ if(eError != OMX_ErrorNone)
+ {
+ DOMX_ERROR("Proxy common deinit returned error = %x",eError);
+ }
+ pComponentPrivate = NULL;
+
+ if(DUCATI_IN_SECURE_MODE == 1 && SECURE_COMPONENTS_RUNNING == 1)
+ {
+ ret = write(secure_misc_drv_fd, &disable, sizeof(disable));
+ if (ret < 0)
+ {
+ DOMX_ERROR("Setting unsecure mode failed");
+ }
+
+ ret = close(secure_misc_drv_fd);
+ if (ret < 0)
+ {
+ DOMX_ERROR("Can't close the driver");
+ }
+ DUCATI_IN_SECURE_MODE = 0;
+ }
+
+ SECURE_COMPONENTS_RUNNING--;
+
+ return eError;
+}
+
diff --git a/omap4.mk b/omap4.mk
index 0936b98..2b02c86 100644
--- a/omap4.mk
+++ b/omap4.mk
@@ -21,6 +21,7 @@ PRODUCT_PACKAGES := \
libOMX.TI.DUCATI1.VIDEO.H264E \
libOMX.TI.DUCATI1.VIDEO.MPEG4E \
libOMX.TI.DUCATI1.VIDEO.DECODER \
+ libOMX.TI.DUCATI1.VIDEO.DECODER.secure \
libOMX.TI.DUCATI1.VIDEO.CAMERA \
libOMX.TI.DUCATI1.MISC.SAMPLE \
libstagefrighthw \