diff options
author | SooChan Lim <sc1.lim@samsung.com> | 2014-10-03 11:36:05 +0900 |
---|---|---|
committer | SooChan Lim <sc1.lim@samsung.com> | 2014-10-03 11:36:41 +0900 |
commit | 2911b02885d49e3bb8047160a4c9ae6df617a638 (patch) | |
tree | 45124f2f2cf1841be4ab552124a5565d8c5f27a1 | |
parent | 9b09ca4c4024f87fc1674902d3e6bd9afbdc3b41 (diff) | |
parent | d2959b27fa5c8f3d5d963b2689d1b81fe5ceab36 (diff) | |
download | libtbm-tizen_3.0.2014.q3_common.tar.gz libtbm-tizen_3.0.2014.q3_common.tar.bz2 libtbm-tizen_3.0.2014.q3_common.zip |
Merge branch 'devel/tizen' into tizentizen_3.0.m14.3_ivi_releasetizen_3.0.2014.q3_common_releasesubmit/tizen_mobile/20141120.000000submit/tizen_ivi/20141007.444444submit/tizen_common/20141003.040915accepted/tizen/ivi/20141009.080624accepted/tizen/common/20141003.171531tizen_3.0.m14.3_ivitizen_3.0.2014.q3_commonaccepted/tizen_3.0.m14.3_iviaccepted/tizen_3.0.2014.q3_common
Change-Id: I791765610e66d36e65c37061eb56bbc04ad44fe1
-rw-r--r--[-rwxr-xr-x] | src/tbm_bufmgr.c | 50 | ||||
-rwxr-xr-x | src/tbm_bufmgr.h | 2 | ||||
-rwxr-xr-x | src/tbm_bufmgr_backend.h | 17 |
3 files changed, 64 insertions, 5 deletions
diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index c4a17d2..b9ac45d 100755..100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -1176,7 +1176,44 @@ tbm_bo_import (tbm_bufmgr bufmgr, unsigned int key) tbm_bo tbm_bo_import_fd (tbm_bufmgr bufmgr, tbm_fd fd) { + TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL); + tbm_bo bo = NULL; + void * bo_priv = NULL; + + bo = calloc (1, sizeof(struct _tbm_bo)); + if(!bo) + return NULL; + + bo->bufmgr = bufmgr; + + pthread_mutex_lock (&bufmgr->lock); + + bo_priv = bufmgr->backend->bo_import_fd(bo, fd); + if (!bo_priv) + { + free (bo); + pthread_mutex_unlock (&bufmgr->lock); + return NULL; + } + + bo->ref_cnt = 1; + bo->tgl_key = INITIAL_KEY; + bo->priv = bo_priv; + + /* init bo state */ + if (!_tbm_bo_init_state (bo, CACHE_OP_IMPORT)) + { + _tbm_bo_unref (bo); + pthread_mutex_unlock (&bufmgr->lock); + return NULL; + } + + LIST_INITHEAD (&bo->user_data_list); + + LIST_ADD (&bo->item_link, &bufmgr->bo_list); + + pthread_mutex_unlock (&bufmgr->lock); return bo; } @@ -1201,9 +1238,18 @@ tbm_bo_export (tbm_bo bo) tbm_fd tbm_bo_export_fd (tbm_bo bo) { - tbm_fd fd = 0; + TBM_RETURN_VAL_IF_FAIL (_tbm_bo_is_valid(bo), 0); + + tbm_bufmgr bufmgr; + int ret; - return fd; + bufmgr = bo->bufmgr; + + pthread_mutex_lock (&bufmgr->lock); + ret = bufmgr->backend->bo_export_fd (bo); + pthread_mutex_unlock (&bufmgr->lock); + + return ret; } diff --git a/src/tbm_bufmgr.h b/src/tbm_bufmgr.h index 83bdc54..d8e18db 100755 --- a/src/tbm_bufmgr.h +++ b/src/tbm_bufmgr.h @@ -524,7 +524,7 @@ tbm_bo tbm_bo_import (tbm_bufmgr bufmgr, tbm_key key); ... bufmgr = tbm_bufmgr_init (bufmgr_fd); - bo = tbm_bo_import (bo_fd); + bo = tbm_bo_import_fd (bo_fd); ... diff --git a/src/tbm_bufmgr_backend.h b/src/tbm_bufmgr_backend.h index fe4d3a7..3e3150f 100755 --- a/src/tbm_bufmgr_backend.h +++ b/src/tbm_bufmgr_backend.h @@ -235,6 +235,21 @@ struct _tbm_bufmgr_backend */ int (*surface_get_plane_data) (tbm_surface_h surface, int width, int height, tbm_format format, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch); + /** + * @brief import the buffer object associated with the prime fd. + * @param[in] bo : the buffer object + * @param[in] fd : the prime fd associated with the buffer object + * @return pointer of the bo private. + */ + void * (*bo_import_fd) (tbm_bo bo, tbm_fd fd); + + /** + * @brief export the buffer object + * @param[in] bo : the buffer object + * @return tbm_fd associated with the buffer object + */ + tbm_fd (*bo_export_fd) (tbm_bo bo); + /* Padding for future extension */ void (*reserved1) (void); void (*reserved2) (void); @@ -242,8 +257,6 @@ struct _tbm_bufmgr_backend void (*reserved4) (void); void (*reserved5) (void); void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); }; /** |