diff options
author | Saurabh Bipin Chandra | 2013-08-30 06:58:19 -0500 |
---|---|---|
committer | Saurabh Bipin Chandra | 2013-09-04 07:38:50 -0500 |
commit | fde931439600e9be8f4556960230f6b62a474ade (patch) | |
tree | 3300cbf744abe9f8cd9584f9891c3b045af81a94 /libdce.c | |
parent | bd95703493320275efe5b3d0db6d75e783a88414 (diff) | |
download | hardware-ti-libdce-fde931439600e9be8f4556960230f6b62a474ade.tar.gz hardware-ti-libdce-fde931439600e9be8f4556960230f6b62a474ade.tar.xz hardware-ti-libdce-fde931439600e9be8f4556960230f6b62a474ade.zip |
[LINUX] Expose API to lock and Unlock IO Buffers
This patch exposes APIs:
dce_buf_lock(int num, size_t *handle)
dce_buf_unlock(int num, size_t *handle)
to lock and unlock the Input/Output Buffers respectively.
The change is specific to GLP.
The DRM driver pins and unpins tiler address for the
IO Buffers whenever the rpmsg_rpc driver calls
map_attachment and unmap_attachment() respectively.
As the rpmsg_rpc driver invokes these calls during every
process call, the reference buffer addresses (address of
past locked buffers) held by the codec gets invalidated.
That is, these addresses will not continue to map to the
same memory region (YUV reference buffer) as before.
Most often, these virtual addresses may point to the
next YUV Buffer translated from the MPU.
These APIs put a condition on the map and unmap() within
rpmsg_rpc.
The expectation from the application is to
call dce_buf_lock() for the inArgs.inputID buffer
and dce_buf_unlock() for the outArgs.freeBufID buffer.
Change-Id: Ic749c6b18385f9052a2eeb4e16959063c5efab5e
Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r-- | libdce.c | 52 |
1 files changed, 50 insertions, 2 deletions
@@ -158,6 +158,53 @@ void dce_free(void *ptr) | |||
158 | memplugin_free(ptr, TILER_1D_BUFFER); | 158 | memplugin_free(ptr, TILER_1D_BUFFER); |
159 | } | 159 | } |
160 | 160 | ||
161 | #if defined(BUILDOS_LINUX) | ||
162 | int dce_buf_lock(int num, size_t *handle) | ||
163 | { | ||
164 | int i; | ||
165 | MmRpc_BufDesc *desc = NULL; | ||
166 | dce_error_status eError = DCE_EOK; | ||
167 | |||
168 | _ASSERT(num > 0, DCE_EINVALID_INPUT); | ||
169 | |||
170 | desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 0, TILER_1D_BUFFER); | ||
171 | _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY); | ||
172 | |||
173 | for( i = 0; i < num; i++ ) { | ||
174 | desc[i].handle = handle[i]; | ||
175 | } | ||
176 | |||
177 | eError = MmRpc_use(MmRpcHandle, MmRpc_BufType_Handle, num, desc); | ||
178 | |||
179 | _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); | ||
180 | EXIT: | ||
181 | return (eError); | ||
182 | } | ||
183 | |||
184 | int dce_buf_unlock(int num, size_t *handle) | ||
185 | { | ||
186 | int i; | ||
187 | MmRpc_BufDesc *desc = NULL; | ||
188 | dce_error_status eError = DCE_EOK; | ||
189 | |||
190 | _ASSERT(num > 0, DCE_EINVALID_INPUT); | ||
191 | |||
192 | desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 0, TILER_1D_BUFFER); | ||
193 | _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY); | ||
194 | |||
195 | for( i = 0; i < num; i++ ) { | ||
196 | desc[i].handle = handle[i]; | ||
197 | } | ||
198 | |||
199 | eError = MmRpc_release(MmRpcHandle, MmRpc_BufType_Handle, num, desc); | ||
200 | |||
201 | _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); | ||
202 | EXIT: | ||
203 | return (eError); | ||
204 | } | ||
205 | |||
206 | #endif /* BUILDOS_LINUX */ | ||
207 | |||
161 | /*************** Startup/Shutdown Functions ***********************/ | 208 | /*************** Startup/Shutdown Functions ***********************/ |
162 | static int dce_init(void) | 209 | static int dce_init(void) |
163 | { | 210 | { |
@@ -561,16 +608,17 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs, | |||
561 | } | 608 | } |
562 | } | 609 | } |
563 | 610 | ||
611 | /* Output Buffers */ | ||
564 | for( count = 0; count < numOutBufs; count++, total_count++ ) { | 612 | for( count = 0; count < numOutBufs; count++, total_count++ ) { |
565 | if(((XDM2_BufDesc *)outBufs)->descs[LUMA_BUF].buf != ((XDM2_BufDesc *)outBufs)->descs[CHROMA_BUF].buf ) { | 613 | if(((XDM2_BufDesc *)outBufs)->descs[LUMA_BUF].buf != ((XDM2_BufDesc *)outBufs)->descs[CHROMA_BUF].buf ) { |
566 | /* MultiPlanar Buffers */ | 614 | /* Either Encode usecase or MultiPlanar Buffers for Decode usecase */ |
567 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); | 615 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); |
568 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, (int32_t)outBufs, | 616 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, (int32_t)outBufs, |
569 | (int32_t)data_buf, (size_t)*data_buf); | 617 | (int32_t)data_buf, (size_t)*data_buf); |
570 | } | 618 | } |
571 | #if defined(BUILDOS_LINUX) | 619 | #if defined(BUILDOS_LINUX) |
572 | else { | 620 | else { |
573 | /* SinglePlanar Buffers */ | 621 | /* SinglePlanar Buffers for Decode usecase*/ |
574 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); | 622 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); |
575 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, (int32_t)outBufs, | 623 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, (int32_t)outBufs, |
576 | (int32_t)data_buf, (size_t)*data_buf); | 624 | (int32_t)data_buf, (size_t)*data_buf); |