aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunita Nadampalli2015-01-30 10:17:17 -0600
committerSunita Nadampalli2015-01-30 10:17:17 -0600
commit74ce64ad788921b1db9d9ebee0562db57caa95e7 (patch)
tree90bf1d24cce31b071e7d3c6e8e19302dd0d1617c /libdce_android.c
parente7cf246bec2118890021e1aeb66757f5ad894923 (diff)
downloadrepo-libdce-74ce64ad788921b1db9d9ebee0562db57caa95e7.tar.gz
repo-libdce-74ce64ad788921b1db9d9ebee0562db57caa95e7.tar.xz
repo-libdce-74ce64ad788921b1db9d9ebee0562db57caa95e7.zip
libdce: Add mutex protection for dce_buf_lock/dce_buf_unlock
The dce_buf_lock and dce_buf_unlock are meant for any video buffer locking and unlocking with the GEM allocator. Currently, these methods are being called from libdce apis with ipc mutex held. In order to enable other media components to make use of these buffer lock/unlock apis, explicit ipc mutex protection is added. Change-Id: I6d63a4cdcffec62a346341ff515a7ebb03dea8c0 Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Diffstat (limited to 'libdce_android.c')
-rw-r--r--libdce_android.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libdce_android.c b/libdce_android.c
index 300c311..9480926 100644
--- a/libdce_android.c
+++ b/libdce_android.c
@@ -33,6 +33,7 @@
33#include <stdlib.h> 33#include <stdlib.h>
34#include <string.h> 34#include <string.h>
35#include <stdio.h> 35#include <stdio.h>
36#include <pthread.h>
36 37
37#include <ti/ipc/mm/MmRpc.h> 38#include <ti/ipc/mm/MmRpc.h>
38#include "dce_priv.h" 39#include "dce_priv.h"
@@ -42,6 +43,7 @@
42 43
43 44
44extern MmRpc_Handle MmRpcHandle[]; 45extern MmRpc_Handle MmRpcHandle[];
46extern pthread_mutex_t ipc_mutex;
45 47
46int dce_buf_lock(int num, size_t *handle) 48int dce_buf_lock(int num, size_t *handle)
47{ 49{
@@ -49,6 +51,8 @@ int dce_buf_lock(int num, size_t *handle)
49 MmRpc_BufDesc *desc = NULL; 51 MmRpc_BufDesc *desc = NULL;
50 dce_error_status eError = DCE_EOK; 52 dce_error_status eError = DCE_EOK;
51 53
54 pthread_mutex_lock(&ipc_mutex);
55
52 _ASSERT(num > 0, DCE_EINVALID_INPUT); 56 _ASSERT(num > 0, DCE_EINVALID_INPUT);
53 57
54 desc = malloc(num * sizeof(MmRpc_BufDesc)); 58 desc = malloc(num * sizeof(MmRpc_BufDesc));
@@ -65,6 +69,8 @@ EXIT:
65 if( desc ) { 69 if( desc ) {
66 free(desc); 70 free(desc);
67 } 71 }
72 pthread_mutex_unlock(&ipc_mutex);
73
68 return (eError); 74 return (eError);
69} 75}
70 76
@@ -74,6 +80,8 @@ int dce_buf_unlock(int num, size_t *handle)
74 MmRpc_BufDesc *desc = NULL; 80 MmRpc_BufDesc *desc = NULL;
75 dce_error_status eError = DCE_EOK; 81 dce_error_status eError = DCE_EOK;
76 82
83 pthread_mutex_lock(&ipc_mutex);
84
77 _ASSERT(num > 0, DCE_EINVALID_INPUT); 85 _ASSERT(num > 0, DCE_EINVALID_INPUT);
78 86
79 desc = malloc(num * sizeof(MmRpc_BufDesc)); 87 desc = malloc(num * sizeof(MmRpc_BufDesc));
@@ -90,6 +98,9 @@ EXIT:
90 if( desc ) { 98 if( desc ) {
91 free(desc); 99 free(desc);
92 } 100 }
101
102 pthread_mutex_unlock(&ipc_mutex);
103
93 return (eError); 104 return (eError);
94} 105}
95 106