add tbm_bo_alloc_with_bo_data 40/257740/1 submit/tizen/20210608.001222
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 30 Apr 2021 04:33:54 +0000 (13:33 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 30 Apr 2021 04:34:58 +0000 (13:34 +0900)
The tbm_bo_alloc_with_bo_data allocate tbm_bo with tbm_backend_bo_data.

Change-Id: I2980170d99e907e64c263468ade10be8bf40fe17

src/tbm_bo.c
src/tbm_bufmgr_int.h

index 4e380ca..044b5ec 100644 (file)
@@ -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
index f2287d3..c7cc6bf 100644 (file)
@@ -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_ */