aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2016-12-09 16:14:09 -0600
committerAngela Stegmaier <angelabaker@ti.com>2017-01-17 15:46:27 -0500
commit5fd7da53b505e1bc80a0c9d116fe31e5cd177d74 (patch)
tree53fc0f5585beb0ad879797e59889ba3f31a8bbab
parentc51f144b079836afb868bff44afe7308248a0217 (diff)
downloaddce-5fd7da53b505e1bc80a0c9d116fe31e5cd177d74.tar.gz
libdce[Android]: Add dce_ipc_recover API
In case of remote core recovery due to remote core crash, the rpmsg-dce handle needs to be closed and re-opened since any handles that were open when the crash happened are marked as stale in the driver. This patch adds a new API that the user can call to close the rpmsg-dce handle so that recovery can happen. In case the user receives notification of a remote core crash, it can call the dce_ipc_recover() API to make sure that the rpmsg-dce handle that is opened during dce_buf_lock is closed so that a new one can be opened the next time. Change-Id: I8ebc19e308ffe7431b57c31cfecd469e171777f6 Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--libdce.h6
-rw-r--r--libdce_android.c9
-rw-r--r--memplugin_android.c6
3 files changed, 18 insertions, 3 deletions
diff --git a/libdce.h b/libdce.h
index f17422e..bbc7c13 100644
--- a/libdce.h
+++ b/libdce.h
@@ -132,6 +132,12 @@ int dce_ipc_init(int core);
*/
void dce_ipc_deinit(int core, int tableIdx);
+/*===============================================================*/
+/** dce_ipc_recover : Recover the DCE IPC in case of
+ * remote core crash.
+ */
+void dce_ipc_recover(void);
+
/************************ Input/Output Buffer Lock/Unlock APIs ************************/
/*=====================================================================================*/
/** dce_buf_lock : Pin or lock Tiler Buffers which would be used by the IVAHD codec
diff --git a/libdce_android.c b/libdce_android.c
index de6a5c8..0c6065a 100644
--- a/libdce_android.c
+++ b/libdce_android.c
@@ -45,6 +45,7 @@
extern MmRpc_Handle MmRpcHandle[];
extern pthread_mutex_t ipc_mutex;
int is_ipc_ready = 0;
+static int dce_buf_count = 0;
int dce_buf_lock(int num, size_t *handle)
{
@@ -113,4 +114,10 @@ EXIT:
return (eError);
}
-
+void dce_ipc_recover(void)
+{
+ if (is_ipc_ready) {
+ dce_ipc_deinit(IPU, -1);
+ is_ipc_ready = 0;
+ }
+}
diff --git a/memplugin_android.c b/memplugin_android.c
index 22a5564..b140aa5 100644
--- a/memplugin_android.c
+++ b/memplugin_android.c
@@ -99,8 +99,10 @@ int memplugin_close()
/*Acquire permission to use IPC*/
pthread_mutex_lock(&ipc_mutex);
- dce_ipc_deinit(IPU, -1);
- is_ipc_ready = 0;
+ if (is_ipc_ready) {
+ dce_ipc_deinit(IPU, -1);
+ is_ipc_ready = 0;
+ }
/*Relinquish IPC*/
pthread_mutex_unlock(&ipc_mutex);