From: SooChan Lim Date: Fri, 30 Apr 2021 04:33:54 +0000 (+0900) Subject: add tbm_bo_alloc_with_bo_data X-Git-Tag: submit/tizen/20210608.001222^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibtbm.git;a=commitdiff_plain;h=731fc27849f8b30b4e340d72b16f9844b91b79f3 add tbm_bo_alloc_with_bo_data The tbm_bo_alloc_with_bo_data allocate tbm_bo with tbm_backend_bo_data. Change-Id: I2980170d99e907e64c263468ade10be8bf40fe17 --- diff --git a/src/tbm_bo.c b/src/tbm_bo.c index 4e380ca..044b5ec 100644 --- a/src/tbm_bo.c +++ b/src/tbm_bo.c @@ -613,6 +613,40 @@ tbm_bo_alloc_with_surface(tbm_bufmgr bufmgr, int width, int height, int format, return bo; } + +tbm_bo +tbm_bo_alloc_with_bo_data(tbm_bufmgr bufmgr, tbm_backend_bo_data *bo_data, int flags) +{ + tbm_bo bo; + + _tbm_bufmgr_mutex_lock(); + _tbm_set_last_result(TBM_ERROR_NONE); + + TBM_BO_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL); + TBM_BO_RETURN_VAL_IF_FAIL(bo_data, NULL); + + bo = calloc(1, sizeof(struct _tbm_bo)); + if (!bo) { + /* LCOV_EXCL_START */ + _tbm_set_last_result(TBM_ERROR_OUT_OF_MEMORY); + _tbm_bufmgr_mutex_unlock(); + return NULL; + /* LCOV_EXCL_STOP */ + } + + _tbm_util_check_bo_cnt(bufmgr); + + bo->bo_data = bo_data; + + _tbm_bo_init(bufmgr, bo, flags); + + TBM_TRACE_BO("bo(%p) refcnt(%d), flag(%s)\n", bo, bo->ref_cnt, _tbm_flag_to_str(bo->flags)); + + _tbm_bufmgr_mutex_unlock(); + + return bo; +} + /* LCOV_EXCL_STOP */ tbm_bo diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index f2287d3..c7cc6bf 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -319,5 +319,6 @@ tbm_bo tbm_bo_alloc_with_format(tbm_bufmgr bufmgr, int format, int bo_idx, int w tbm_bo tbm_bo_alloc_with_tiled_format(tbm_bufmgr bufmgr, int width, int height, int bpp, int format, tbm_bo_memory_type flags, int bo_idx, tbm_error_e *error); tbm_bo tbm_bo_alloc_with_surface(tbm_bufmgr bufmgr, int width, int height, int format, int flags, int bo_idx); +tbm_bo tbm_bo_alloc_with_bo_data(tbm_bufmgr bufmgr, tbm_backend_bo_data *bo_data, int flags); #endif /* _TBM_BUFMGR_INT_H_ */