tbm_last_error = err;
}
+/* LCOV_EXCL_START */
static bool
_tbm_bufmgr_mutex_init(void)
{
return str;
}
-/* LCOV_EXCL_START */
static void
_tbm_util_check_bo_cnt(tbm_bufmgr bufmgr)
{
user_data = calloc(1, sizeof(tbm_user_data));
if (!user_data) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("fail to allocate an user_date\n");
return NULL;
+ /* LCOV_EXCL_STOP */
}
user_data->key = key;
} else
bTrace = 0;
#endif
- /* LCOV_EXCL_STOP */
pthread_mutex_lock(&gLock);
TBM_LOG_W("!!!!!WARNING:: IT WILL BE CHANGED like tbm_bufmgr_init(int fd) --> tbm_bufmgr_init(void).\n");
}
+
/* initialize buffer manager */
if (gBufMgr) {
gBufMgr->ref_count++;
/* load bufmgr priv from env */
if (!_tbm_load_module(gBufMgr, gBufMgr->fd)) {
- /* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_LOAD_MODULE_FAILED);
TBM_LOG_E("error : Fail to load bufmgr backend\n");
free(gBufMgr);
gBufMgr = NULL;
pthread_mutex_unlock(&gLock);
return NULL;
- /* LCOV_EXCL_STOP */
+
}
+ /* LCOV_EXCL_STOP */
/* log for tbm backend_flag */
TBM_DBG("backend flag:%x:", gBufMgr->backend->flags);
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: fail to create of tbm_bo size(%d) flag(%s)\n",
size, _tbm_flag_to_str(flags));
_tbm_set_last_result(TBM_BO_ERROR_HEAP_ALLOC_FAILED);
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
_tbm_util_check_bo_cnt(bufmgr);
bo_priv = bufmgr->backend->bo_alloc(bo, size, flags);
if (!bo_priv) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: fail to create of tbm_bo size(%d) flag(%s)\n",
size, _tbm_flag_to_str(flags));
_tbm_set_last_result(TBM_BO_ERROR_BO_ALLOC_FAILED);
free(bo);
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
bufmgr->bo_cnt++;
TBM_BUFMGR_RETURN_VAL_IF_FAIL(bufmgr == gBufMgr, NULL);
if (!bufmgr->backend->bo_import) {
+ /* LCOV_EXCL_START */
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
_tbm_util_check_bo_cnt(bufmgr);
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: fail to import of tbm_bo by key(%d)\n", key);
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
bo->bufmgr = bufmgr;
bo_priv = bufmgr->backend->bo_import(bo, key);
if (!bo_priv) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: fail to import of tbm_bo by key(%d)\n", key);
_tbm_set_last_result(TBM_BO_ERROR_IMPORT_FAILED);
free(bo);
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
if (!LIST_IS_EMPTY(&bufmgr->bo_list)) {
TBM_BUFMGR_RETURN_VAL_IF_FAIL(bufmgr == gBufMgr, NULL);
if (!bufmgr->backend->bo_import_fd) {
+ /* LCOV_EXCL_START */
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
_tbm_util_check_bo_cnt(bufmgr);
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: fail to import tbm_bo by tbm_fd(%d)\n", fd);
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
bo->bufmgr = bufmgr;
bo_priv = bufmgr->backend->bo_import_fd(bo, fd);
if (!bo_priv) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: fail to import tbm_bo by tbm_fd(%d)\n", fd);
_tbm_set_last_result(TBM_BO_ERROR_IMPORT_FD_FAILED);
free(bo);
_tbm_bufmgr_mutex_unlock();
return NULL;
+ /* LCOV_EXCL_STOP */
}
if (!LIST_IS_EMPTY(&bufmgr->bo_list)) {
TBM_BUFMGR_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
if (!bufmgr->backend->bo_export) {
+ /* LCOV_EXCL_START */
_tbm_bufmgr_mutex_unlock();
return 0;
+ /* LCOV_EXCL_STOP */
}
ret = bufmgr->backend->bo_export(bo);
if (!ret) {
+ /* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_EXPORT_FAILED);
TBM_LOG_E("error: bo(%p) tbm_key(%d)\n", bo, ret);
_tbm_bufmgr_mutex_unlock();
return ret;
+ /* LCOV_EXCL_STOP */
}
TBM_TRACE("bo(%p) tbm_key(%u)\n", bo, ret);
TBM_BUFMGR_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), -1);
if (!bufmgr->backend->bo_export_fd) {
+ /* LCOV_EXCL_START */
_tbm_bufmgr_mutex_unlock();
return -1;
+ /* LCOV_EXCL_STOP */
}
ret = bufmgr->backend->bo_export_fd(bo);
if (ret < 0) {
+ /* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_EXPORT_FD_FAILED);
TBM_LOG_E("error: bo(%p) tbm_fd(%d)\n", bo, ret);
_tbm_bufmgr_mutex_unlock();
return ret;
+ /* LCOV_EXCL_STOP */
}
TBM_TRACE("bo(%p) tbm_fd(%d)\n", bo, ret);
bo_handle = bufmgr->backend->bo_get_handle(bo, device);
if (bo_handle.ptr == NULL) {
+ /* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_GET_HANDLE_FAILED);
TBM_LOG_E("error: bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
_tbm_bufmgr_mutex_unlock();
return (tbm_bo_handle) NULL;
+ /* LCOV_EXCL_STOP */
}
TBM_TRACE("bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
bo_handle = bufmgr->backend->bo_map(bo, device, opt);
if (bo_handle.ptr == NULL) {
+ /* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_MAP_FAILED);
TBM_LOG_E("error: fail to map bo:%p\n", bo);
_tbm_bo_unlock(bo);
_tbm_bufmgr_mutex_unlock();
return (tbm_bo_handle) NULL;
+ /* LCOV_EXCL_STOP */
}
/* increase the map_count */
ret = bufmgr->backend->bo_unmap(bo);
if (!ret) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("error: bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
_tbm_set_last_result(TBM_BO_ERROR_UNMAP_FAILED);
_tbm_bufmgr_mutex_unlock();
return ret;
+ /* LCOV_EXCL_STOP */
}
/* decrease the map_count */
return 1;
}
-/* LCOV_EXCL_STOP */
int tbm_bufmgr_get_fd_limit(void)
{
return (int)lim.rlim_cur;
}
-
+/* LCOV_EXCL_STOP */
}
/* LCOV_EXCL_START */
-
static double
_tbm_surface_internal_get_time(void)
{
return "unknwon";
}
}
-/* LCOV_EXCL_STOP */
static bool
_tbm_surface_mutex_init(void)
tbm_bufmgr_deinit(g_surface_bufmgr);
g_surface_bufmgr = NULL;
}
+/* LCOV_EXCL_STOP */
static int
_tbm_surface_internal_is_valid(tbm_surface_h surface)
ret = mgr->backend->surface_get_plane_data(surf->info.width,
surf->info.height, surf->info.format, plane_idx, size, offset, pitch, bo_idx);
if (!ret) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("Fail to surface_get_plane_data. surface(%p)\n", surface);
return 0;
+ /* LCOV_EXCL_STOP */
}
return 1;
ret = mgr->backend->surface_supported_format(formats, num);
if (!ret) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("Fail to surface_supported_format.\n");
goto fail;
+ /* LCOV_EXCL_START */
}
TBM_TRACE("tbm_bufmgr(%p) format num(%u)\n", g_surface_bufmgr, *num);
return ret;
+/* LCOV_EXCL_START */
fail:
if (bufmgr_initialized) {
LIST_DELINIT(&g_surface_bufmgr->surf_list);
TBM_LOG_E("error: tbm_bufmgr(%p)\n", g_surface_bufmgr);
return 0;
+/* LCOV_EXCL_STOP */
}
int
surf = calloc(1, sizeof(struct _tbm_surface));
if (!surf) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("fail to alloc surf\n");
goto alloc_surf_fail;
+ /* LCOV_EXCL_STOP */
}
surf->bufmgr = mgr;
return surf;
+/* LCOV_EXCL_START */
alloc_bo_fail:
for (j = 0; j < i; j++) {
if (surf->bos[j])
TBM_LOG_E("error: width(%d) height(%d) format(%s) flags(%d)\n",
width, height,
_tbm_surface_internal_format_to_str(format), flags);
+/* LCOV_EXCL_STOP */
return NULL;
}
surf = calloc(1, sizeof(struct _tbm_surface));
if (!surf) {
+ /* LCOV_EXCL_START */
TBM_LOG_E("fail to allocate struct _tbm_surface.\n");
goto alloc_surf_fail;
+ /* LCOV_EXCL_STOP */
}
surf->bufmgr = mgr;
return surf;
+/* LCOV_EXCL_START */
check_bo_fail:
for (i = 0; i < num; i++) {
if (surf->bos[i])
TBM_LOG_E("error: width(%u) height(%u) format(%s) bo_num(%d)\n",
info->width, info->height,
_tbm_surface_internal_format_to_str(info->format), num);
+/* LCOV_EXCL_STOP */
return NULL;
}