aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPradeep Venkatasubbarao2013-12-05 06:19:48 -0600
committerPradeep Venkatasubbarao2013-12-06 03:01:23 -0600
commitbc0b3b5324462fa7ced293982ecc605d0a8b66ad (patch)
tree2dcd119896e24ade97d96660b1830e1d38980209 /libdce_linux.c
parent9208d0f18664575c0a50420435c19c85ff9740dd (diff)
downloadrepo-libdce-bc0b3b5324462fa7ced293982ecc605d0a8b66ad.tar.gz
repo-libdce-bc0b3b5324462fa7ced293982ecc605d0a8b66ad.tar.xz
repo-libdce-bc0b3b5324462fa7ced293982ecc605d0a8b66ad.zip
[DSP]Added duplicate functions for buffer lock and unlock.
This is required temporarily as there is no other way to get the core index.dce_buf_lock and unlock functions expects MmRpcHandle and now as there are separate handles for DSP and IPU, to avoid modifying these APIs, duplicate functions have been created coreIndex is hardcoded. Added prototypes of dsp specific lock and unlock functions in libdce.h Change-Id: I360632acd061f9e134c38bea009b1ad257e32bb8 Signed-off-by: Pradeep Venkatasubbarao <pradeepv@ti.com>
Diffstat (limited to 'libdce_linux.c')
-rw-r--r--libdce_linux.c59
1 files changed, 56 insertions, 3 deletions
diff --git a/libdce_linux.c b/libdce_linux.c
index 2eeb1bd..6fc2124 100644
--- a/libdce_linux.c
+++ b/libdce_linux.c
@@ -41,6 +41,7 @@
41#include <MmRpc.h> 41#include <MmRpc.h>
42#include "dce_priv.h" 42#include "dce_priv.h"
43#include "libdce.h" 43#include "libdce.h"
44#include "dce_rpc.h"
44#include "memplugin.h" 45#include "memplugin.h"
45 46
46#define INVALID_DRM_FD (-1) 47#define INVALID_DRM_FD (-1)
@@ -48,7 +49,7 @@
48int OmapDrm_FD = INVALID_DRM_FD; 49int OmapDrm_FD = INVALID_DRM_FD;
49int bDrmOpenedByDce = FALSE; 50int bDrmOpenedByDce = FALSE;
50struct omap_device *OmapDev = NULL; 51struct omap_device *OmapDev = NULL;
51extern MmRpc_Handle MmRpcHandle; 52extern MmRpc_Handle MmRpcHandle[];
52 53
53void *dce_init(void) 54void *dce_init(void)
54{ 55{
@@ -98,7 +99,7 @@ int dce_buf_lock(int num, size_t *handle)
98 desc[i].handle = handle[i]; 99 desc[i].handle = handle[i];
99 } 100 }
100 101
101 eError = MmRpc_use(MmRpcHandle, MmRpc_BufType_Handle, num, desc); 102 eError = MmRpc_use(MmRpcHandle[IPU], MmRpc_BufType_Handle, num, desc);
102 103
103 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 104 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
104EXIT: 105EXIT:
@@ -123,7 +124,35 @@ int dce_buf_unlock(int num, size_t *handle)
123 desc[i].handle = handle[i]; 124 desc[i].handle = handle[i];
124 } 125 }
125 126
126 eError = MmRpc_release(MmRpcHandle, MmRpc_BufType_Handle, num, desc); 127 eError = MmRpc_release(MmRpcHandle[IPU], MmRpc_BufType_Handle, num, desc);
128
129 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
130EXIT:
131 if( desc ) {
132 free(desc);
133 }
134 return (eError);
135}
136/*These two are duplicate of above two functions
137 These have been added temporarily since there is no
138 other way to get the core index.These have been
139 added to avoid modifying the current apis */
140int dsp_dce_buf_lock(int num, size_t *handle)
141{
142 int i;
143 MmRpc_BufDesc *desc = NULL;
144 dce_error_status eError = DCE_EOK;
145
146 _ASSERT(num > 0, DCE_EINVALID_INPUT);
147
148 desc = malloc(num * sizeof(MmRpc_BufDesc));
149 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY);
150
151 for( i = 0; i < num; i++ ) {
152 desc[i].handle = handle[i];
153 }
154
155 eError = MmRpc_use(MmRpcHandle[DSP], MmRpc_BufType_Handle, num, desc);
127 156
128 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 157 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
129EXIT: 158EXIT:
@@ -133,6 +162,30 @@ EXIT:
133 return (eError); 162 return (eError);
134} 163}
135 164
165int dsp_dce_buf_unlock(int num, size_t *handle)
166{
167 int i;
168 MmRpc_BufDesc *desc = NULL;
169 dce_error_status eError = DCE_EOK;
170
171 _ASSERT(num > 0, DCE_EINVALID_INPUT);
172
173 desc = malloc(num * sizeof(MmRpc_BufDesc));
174 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY);
175
176 for( i = 0; i < num; i++ ) {
177 desc[i].handle = handle[i];
178 }
179
180 eError = MmRpc_release(MmRpcHandle[DSP], MmRpc_BufType_Handle, num, desc);
181
182 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
183EXIT:
184 if( desc ) {
185 free(desc);
186 }
187 return (eError);
188}
136/* Incase of X11 or Wayland the fd can be shared to libdce using this call */ 189/* Incase of X11 or Wayland the fd can be shared to libdce using this call */
137void dce_set_fd(int dce_fd) 190void dce_set_fd(int dce_fd)
138{ 191{