diff options
author | Buddy Liong | 2013-12-06 14:09:49 -0600 |
---|---|---|
committer | Gerrit Code Review | 2013-12-06 14:09:50 -0600 |
commit | 33343d01a3fe529ab6b1f4060607162047241b5a (patch) | |
tree | 466bd06fe35ec3657de86a908fee537b98e71145 | |
parent | 1d2fcbbbecb2e82b1ce0c79b146a92c8c3cbd707 (diff) | |
parent | bc0b3b5324462fa7ced293982ecc605d0a8b66ad (diff) | |
download | repo-libdce-33343d01a3fe529ab6b1f4060607162047241b5a.tar.gz repo-libdce-33343d01a3fe529ab6b1f4060607162047241b5a.tar.xz repo-libdce-33343d01a3fe529ab6b1f4060607162047241b5a.zip |
Merge "[DSP]Added duplicate functions for buffer lock and unlock."3.00.03.04
-rw-r--r-- | libdce.h | 25 | ||||
-rw-r--r-- | libdce_linux.c | 59 |
2 files changed, 79 insertions, 5 deletions
@@ -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 | */ |
115 | int dce_buf_unlock(int num, size_t *handle); | 115 | int 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 | */ | ||
125 | int 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 | */ | ||
135 | int 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 @@ | |||
48 | int OmapDrm_FD = INVALID_DRM_FD; | 49 | int OmapDrm_FD = INVALID_DRM_FD; |
49 | int bDrmOpenedByDce = FALSE; | 50 | int bDrmOpenedByDce = FALSE; |
50 | struct omap_device *OmapDev = NULL; | 51 | struct omap_device *OmapDev = NULL; |
51 | extern MmRpc_Handle MmRpcHandle; | 52 | extern MmRpc_Handle MmRpcHandle[]; |
52 | 53 | ||
53 | void *dce_init(void) | 54 | void *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); |
104 | EXIT: | 105 | EXIT: |
@@ -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); | ||
130 | EXIT: | ||
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 */ | ||
140 | int 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); |
129 | EXIT: | 158 | EXIT: |
@@ -133,6 +162,30 @@ EXIT: | |||
133 | return (eError); | 162 | return (eError); |
134 | } | 163 | } |
135 | 164 | ||
165 | int 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); | ||
183 | EXIT: | ||
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 */ |
137 | void dce_set_fd(int dce_fd) | 190 | void dce_set_fd(int dce_fd) |
138 | { | 191 | { |