if (!g_surface_bufmgr) {
_init_surface_bufmgr();
+ if (!g_surface_bufmgr) {
+ TBM_ERR("fail bufmgr initialization\n");
+ _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
+ goto fail;
+ }
LIST_INITHEAD(&g_surface_bufmgr->surf_list);
bufmgr_initialized = true;
}
if (!g_surface_bufmgr) {
_init_surface_bufmgr();
+ if (!g_surface_bufmgr) {
+ TBM_ERR("fail bufmgr initialization\n");
+ _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
+ goto check_valid_fail;
+ }
LIST_INITHEAD(&g_surface_bufmgr->surf_list);
bufmgr_initialized = true;
}
bufmgr = g_surface_bufmgr;
if (!TBM_BUFMGR_IS_VALID(bufmgr)) {
TBM_ERR("The bufmgr is invalid\n");
+ _tbm_set_last_result(TBM_ERROR_INVALID_PARAMETER);
goto check_valid_fail;
}
}
if (bufmgr->use_hal_tbm) {
- surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, flags, &error);
+ surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, surf->info.bpp/8, flags, &error);
if (error == TBM_ERROR_NOT_SUPPORTED) {
- if (flags & TBM_BO_TILED) {
- surf->bos[i] = tbm_bo_alloc_with_tiled_format(bufmgr, width, height, surf->info.bpp/8, format, flags, i, &error);
- if (error == TBM_ERROR_NOT_SUPPORTED) {
- surf->bos[i] = tbm_bo_alloc(bufmgr, bo_size, flags);
- } else if (error != TBM_ERROR_NONE) {
- TBM_ERR("fail to alloc bo idx:%d\n", i);
- goto alloc_bo_fail;
- }
- } else {
- surf->bos[i] = tbm_bo_alloc(bufmgr, bo_size, flags);
- }
-
- if (!surf->bos[i]) {
+ if (error != TBM_ERROR_NONE) {
TBM_ERR("fail to alloc bo idx:%d\n", i);
goto alloc_bo_fail;
}
} else if (bufmgr->backend_module_data) {
if (bufmgr->bufmgr_func->bufmgr_alloc_bo_with_format) {
/* LCOV_EXCL_START */
- surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, flags, &error);
+ surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, surf->info.bpp/8, flags, &error);
if (!surf->bos[i]) {
TBM_ERR("fail to tbm_bo_alloc_with_format idx:%d\n", i);
goto alloc_bo_fail;
if (!g_surface_bufmgr) {
_init_surface_bufmgr();
+ if (!g_surface_bufmgr) {
+ TBM_ERR("fail bufmgr initialization\n");
+ _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
+ goto check_valid_fail;
+ }
LIST_INITHEAD(&g_surface_bufmgr->surf_list);
bufmgr_initialized = true;
}