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 /memplugin_android.c
parentf83e785d2b98404fed9e3a6264bf4945c65abd12 (diff)
downloadrepo-libdce-281e466ff5b0344f538ec4e76076290e60774516.tar.gz
repo-libdce-281e466ff5b0344f538ec4e76076290e60774516.tar.xz
repo-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 'memplugin_android.c')
-rw-r--r--memplugin_android.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/memplugin_android.c b/memplugin_android.c
index 7235de2..97ea44a 100644
--- a/memplugin_android.c
+++ b/memplugin_android.c
@@ -51,6 +51,7 @@
51int OmapDrm_FD = INVALID_DRM_FD; 51int OmapDrm_FD = INVALID_DRM_FD;
52struct omap_device *OmapDev = NULL; 52struct omap_device *OmapDev = NULL;
53extern pthread_mutex_t ipc_mutex; 53extern pthread_mutex_t ipc_mutex;
54extern int is_ipc_ready;
54 55
55int memplugin_open() 56int memplugin_open()
56{ 57{
@@ -75,14 +76,6 @@ int memplugin_open()
75 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); 76 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
76 pthread_mutex_init(&ipc_mutex, &attr); 77 pthread_mutex_init(&ipc_mutex, &attr);
77 78
78 if (dce_ipc_init(IPU) != MEM_EOK) {
79 omap_device_del(OmapDev);
80 OmapDev = NULL;
81 close(OmapDrm_FD);
82 OmapDrm_FD = INVALID_DRM_FD;
83 return MEM_EOPEN_FAILURE;
84 }
85
86 return MEM_EOK; 79 return MEM_EOK;
87} 80}
88 81
@@ -99,7 +92,15 @@ int memplugin_close()
99 * this channel is used only for GEM buffer register/unregister, 92 * this channel is used only for GEM buffer register/unregister,
100 * hence call deinit with -1 for the engine table index 93 * hence call deinit with -1 for the engine table index
101 */ 94 */
95
96 /*Acquire permission to use IPC*/
97 pthread_mutex_lock(&ipc_mutex);
98
102 dce_ipc_deinit(IPU, -1); 99 dce_ipc_deinit(IPU, -1);
100 is_ipc_ready = 0;
101
102 /*Relinquish IPC*/
103 pthread_mutex_unlock(&ipc_mutex);
103 104
104 return MEM_EOK; 105 return MEM_EOK;
105} 106}