aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdce.h25
-rw-r--r--libdce_linux.c59
2 files changed, 79 insertions, 5 deletions
diff --git a/libdce.h b/libdce.h
index 69ac370..7e91759 100644
--- a/libdce.h
+++ b/libdce.h
@@ -95,7 +95,7 @@ void dce_deinit(void *dev);
95 95
96/************************ Input/Output Buffer Lock/Unlock APIs ************************/ 96/************************ Input/Output Buffer Lock/Unlock APIs ************************/
97/*=====================================================================================*/ 97/*=====================================================================================*/
98/** dce_buf_lock : Pin or lock Tiler Buffers which would be used by the codec 98/** dce_buf_lock : Pin or lock Tiler Buffers which would be used by the IVAHD codec
99 * as reference buffers. API is specific to GLP. 99 * as reference buffers. API is specific to GLP.
100 * 100 *
101 * @ param num [in] : Number of buffers to be locked. 101 * @ param num [in] : Number of buffers to be locked.
@@ -106,13 +106,34 @@ int dce_buf_lock(int num, size_t *handle);
106 106
107/*=====================================================================================*/ 107/*=====================================================================================*/
108/** dce_buf_unlock : Unpin or unlock Tiler Buffers which were locked to be used 108/** dce_buf_unlock : Unpin or unlock Tiler Buffers which were locked to be used
109 * by the codec as reference buffers. API is specific to GLP. 109 * by the IVAHD codec as reference buffers. API is specific to GLP.
110 * 110 *
111 * @ param num [in] : Number of buffers to be locked. 111 * @ param num [in] : Number of buffers to be locked.
112 * @ param handle [in] : Pointer to array of DMA Buf FDs of the buffers to be locked. 112 * @ param handle [in] : Pointer to array of DMA Buf FDs of the buffers to be locked.
113 * @ return : DCE error status is returned. 113 * @ return : DCE error status is returned.
114 */ 114 */
115int dce_buf_unlock(int num, size_t *handle); 115int dce_buf_unlock(int num, size_t *handle);
116/************************ Input/Output Buffer Lock/Unlock APIs ************************/
117/*=====================================================================================*/
118/** dsp_dce_buf_lock : Pin or lock Tiler Buffers which would be used by the DSP codec
119 * as reference buffers. API is specific to GLP.
120 *
121 * @ param num [in] : Number of buffers to be locked.
122 * @ param handle [in] : Pointer to array of DMA Buf FDs of the buffers to be locked.
123 * @ return : DCE error status is returned.
124 */
125int dsp_dce_buf_lock(int num, size_t *handle);
126
127/*=====================================================================================*/
128/** dsp_dce_buf_unlock : Unpin or unlock Tiler Buffers which were locked to be used
129 * by the DSP codec as reference buffers. API is specific to GLP.
130 *
131 * @ param num [in] : Number of buffers to be locked.
132 * @ param handle [in] : Pointer to array of DMA Buf FDs of the buffers to be locked.
133 * @ return : DCE error status is returned.
134 */
135int dsp_dce_buf_unlock(int num, size_t *handle);
136
116 137
117/******************************* OMAPDRM Get/Set FD APIs *******************************/ 138/******************************* OMAPDRM Get/Set FD APIs *******************************/
118/*=====================================================================================*/ 139/*=====================================================================================*/
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{