aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunita Nadampalli2013-09-13 06:35:59 -0500
committerSunita Nadampalli2013-09-13 06:35:59 -0500
commit2cf98af97f1e826818dafdfe4139506bf4778751 (patch)
tree98af2bf7d4cd07c5a7984f7dcaf561282157ea96 /libdce.c
parent2951de0afaf2ce000d37ec8505b27b05924012dd (diff)
downloadrepo-libdce-2cf98af97f1e826818dafdfe4139506bf4778751.tar.gz
repo-libdce-2cf98af97f1e826818dafdfe4139506bf4778751.tar.xz
repo-libdce-2cf98af97f1e826818dafdfe4139506bf4778751.zip
[LIBDCE] Add Android specific changes
This patch adds changes specific to Android OS: (1) Semaphore handling (2) Input buffer offset handling Change-Id: Id6232e0b90e638fd1268ccbfafb51c6ca916fad2 Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r--libdce.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libdce.c b/libdce.c
index 2b2b179..9dd5bce 100644
--- a/libdce.c
+++ b/libdce.c
@@ -150,8 +150,14 @@ static inline int dce_sem_init(sem_t **sem)
150 if (*sem) 150 if (*sem)
151 return DCE_EOK;; 151 return DCE_EOK;;
152 152
153#ifdef BUILDOS_ANDROID
154 *sem = malloc(sizeof(sem_t));
155 int ret = sem_init(*sem, 0, 1);
156 return ret;
157#else
153 *sem = sem_open("/dce_semaphore", O_CREAT, S_IRWXU | S_IRWXO | S_IRWXG, 1); 158 *sem = sem_open("/dce_semaphore", O_CREAT, S_IRWXU | S_IRWXO | S_IRWXG, 1);
154 return (*sem) ? DCE_EOK : SEM_FAILED; 159 return (*sem) ? DCE_EOK : SEM_FAILED;
160#endif
155} 161}
156 162
157static inline int dce_sem_wait(sem_t *sem) 163static inline int dce_sem_wait(sem_t *sem)
@@ -175,7 +181,12 @@ static inline void dce_sem_close(sem_t **sem)
175 if (NULL == *sem) 181 if (NULL == *sem)
176 return; 182 return;
177 183
184#ifdef BUILDOS_ANDROID
185 sem_destroy(*sem);
186 free(*sem);
187#else
178 sem_close(*sem); 188 sem_close(*sem);
189#endif
179 *sem = NULL; 190 *sem = NULL;
180} 191}
181 192
@@ -516,6 +527,9 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs,
516 int fxnRet, count, total_count, numInBufs = 0, numOutBufs = 0; 527 int fxnRet, count, total_count, numInBufs = 0, numOutBufs = 0;
517 dce_error_status eError = DCE_EOK; 528 dce_error_status eError = DCE_EOK;
518 void * *data_buf = NULL; 529 void * *data_buf = NULL;
530#ifdef BUILDOS_ANDROID
531 int32_t inbuf_offset[MAX_INPUT_BUF];
532#endif
519 533
520 _ASSERT(codec != NULL, DCE_EINVALID_INPUT); 534 _ASSERT(codec != NULL, DCE_EINVALID_INPUT);
521 _ASSERT(inBufs != NULL, DCE_EINVALID_INPUT); 535 _ASSERT(inBufs != NULL, DCE_EINVALID_INPUT);
@@ -552,8 +566,18 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs,
552 for( count = 0, total_count = 0; count < numInBufs; count++, total_count++ ) { 566 for( count = 0, total_count = 0; count < numInBufs; count++, total_count++ ) {
553 if( codec_id == OMAP_DCE_VIDDEC3 ) { 567 if( codec_id == OMAP_DCE_VIDDEC3 ) {
554 data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf)); 568 data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf));
569#ifdef BUILDOS_ANDROID
570 /* the decoder input buffer filled by the parsers, have an offset */
571 /* for the actual data. the offset within the input buffer is provided */
572 /* via memheader offset field. Hence the buf ptr needs to be advanced with the offset */
573 inbuf_offset[count] = P2H(*data_buf)->offset;
574 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf),
575 (size_t)P2H(*data_buf), (size_t)memplugin_share((void*)*data_buf));
576 *(uint8_t*)data_buf += inbuf_offset[count];
577#else
555 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf), 578 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf),
556 (size_t)*data_buf, (size_t)*data_buf); 579 (size_t)*data_buf, (size_t)*data_buf);
580#endif
557 } else if( codec_id == OMAP_DCE_VIDENC2 ) { 581 } else if( codec_id == OMAP_DCE_VIDENC2 ) {
558 data_buf = (void * *)(&(((IVIDEO2_BufDesc *)inBufs)->planeDesc[count].buf)); 582 data_buf = (void * *)(&(((IVIDEO2_BufDesc *)inBufs)->planeDesc[count].buf));
559 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf), 583 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf),
@@ -593,6 +617,16 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs,
593 617
594 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 618 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
595 619
620#ifdef BUILDOS_ANDROID
621 for( count = 0; count < numInBufs; count++) {
622 if( codec_id == OMAP_DCE_VIDDEC3 ) {
623 /* restore the actual buf ptr before returing to the mmf */
624 data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf));
625 *(uint8_t*)data_buf -= inbuf_offset[count];
626 }
627 }
628#endif
629
596 eError = (dce_error_status)(fxnRet); 630 eError = (dce_error_status)(fxnRet);
597EXIT: 631EXIT:
598 return (eError); 632 return (eError);