aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunita Nadampalli2016-08-29 15:42:00 -0500
committerSunita Nadampalli2016-08-29 15:46:27 -0500
commit281e466ff5b0344f538ec4e76076290e60774516 (patch)
tree16e36090faf125a253bdf7491dac2606cddb251b /libdce_android.c
parentf83e785d2b98404fed9e3a6264bf4945c65abd12 (diff)
downloadhardware-ti-libdce-281e466ff5b0344f538ec4e76076290e60774516.tar.gz
hardware-ti-libdce-281e466ff5b0344f538ec4e76076290e60774516.tar.xz
hardware-ti-libdce-281e466ff5b0344f538ec4e76076290e60774516.zip
libdce[Android]: Defer rpmsg_dce device open till buffer lock phase
In the current architecture, rpmsg_dce device is opened during memplugin_open(), which can be called from any process context. With Android system configured in SE Linux Enforcement mode, it is not allowed to open rpmsg_dce in any process other than mediaserver. Hence the device open logic is deferred till dce buffer lock API where the actual device ioctls are needed. Change-Id: Iedacfd3327e0ee975a8a492b057aac576d7f7c10 Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Diffstat (limited to 'libdce_android.c')
-rw-r--r--libdce_android.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libdce_android.c b/libdce_android.c
index 9480926..de6a5c8 100644
--- a/libdce_android.c
+++ b/libdce_android.c
@@ -44,6 +44,7 @@
44 44
45extern MmRpc_Handle MmRpcHandle[]; 45extern MmRpc_Handle MmRpcHandle[];
46extern pthread_mutex_t ipc_mutex; 46extern pthread_mutex_t ipc_mutex;
47int is_ipc_ready = 0;
47 48
48int dce_buf_lock(int num, size_t *handle) 49int dce_buf_lock(int num, size_t *handle)
49{ 50{
@@ -53,6 +54,14 @@ int dce_buf_lock(int num, size_t *handle)
53 54
54 pthread_mutex_lock(&ipc_mutex); 55 pthread_mutex_lock(&ipc_mutex);
55 56
57 if (!is_ipc_ready) {
58 if (dce_ipc_init(IPU) != MEM_EOK) {
59 pthread_mutex_unlock(&ipc_mutex);
60 return DCE_EIPC_CALL_FAIL;
61 }
62 is_ipc_ready = 0x1234;
63 }
64
56 _ASSERT(num > 0, DCE_EINVALID_INPUT); 65 _ASSERT(num > 0, DCE_EINVALID_INPUT);
57 66
58 desc = malloc(num * sizeof(MmRpc_BufDesc)); 67 desc = malloc(num * sizeof(MmRpc_BufDesc));