The tbm_module_bo_get_size calls it's backend function.
Change-Id: I8b06b99e565b673de3a192537658b1bb0e63e1dd
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
- if (bo->bufmgr->use_hal_tbm) {
- size = hal_tbm_bo_get_size((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)&error);
- if (error != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the size of the bo_data(%d).", error);
- _tbm_set_last_result(TBM_ERROR_NONE);
- }
- } else if (bo->bufmgr->backend_module_data) {
- size = bo->bufmgr->bo_func->bo_get_size(bo->bo_data, &error);
- if (error != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the size of the bo_data(%d).", error);
- _tbm_set_last_result(TBM_ERROR_NONE);
- }
- } else
- size = bo->bufmgr->backend->bo_size(bo);
+ size = tbm_module_bo_get_size(bo->bufmgr->module, bo, bo->bo_data, &error);
+ _tbm_set_last_result(error);
TBM_TRACE_BO("bo(%p) size(%d)\n", bo, size);
TBM_TRACE_BO("before: bo1(%p) bo2(%p)\n", bo1, bo2);
- if (bo1->bufmgr->use_hal_tbm) {
- size1 = hal_tbm_bo_get_size((hal_tbm_bo *)bo1->bo_data, (hal_tbm_error *)&error1);
- if (error1 != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the size of bo1.(%d)", error1);
- _tbm_set_last_result(error1);
- goto fail;
- }
- size2 = hal_tbm_bo_get_size((hal_tbm_bo *)bo2->bo_data, (hal_tbm_error *)&error2);
- if (error2 != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the size of bo1.(%d)", error2);
- _tbm_set_last_result(error2);
- goto fail;
- }
- } else if (bo1->bufmgr->backend_module_data) {
- size1 = bo1->bufmgr->bo_func->bo_get_size(bo1->bo_data, &error1);
- if (error1 != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the size of bo1.(%d)", error1);
- _tbm_set_last_result(error1);
- goto fail;
- }
- size2 = bo2->bufmgr->bo_func->bo_get_size(bo2->bo_data, &error2);
- if (error2 != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the size of bo2.(%d)", error2);
- _tbm_set_last_result(error2);
- goto fail;
- }
- } else {
- size1 = bo1->bufmgr->backend->bo_size(bo1);
- size2 = bo2->bufmgr->backend->bo_size(bo2);
- }
+ size1 = tbm_module_bo_get_size(bo1->bufmgr->module, bo1, bo1->bo_data, &error1);
+ _tbm_set_last_result(error1);
+ size2 = tbm_module_bo_get_size(bo2->bufmgr->module, bo2, bo2->bo_data, &error2);
+ _tbm_set_last_result(error2);
if (size1 != size2) {
TBM_ERR("error: bo1 size(%d) and bo2 size(%d) is different.", size1, size2);
TBM_SNRPRINTF(str, len, c, "%s\n", data);
for (i = 0; i < surf->num_bos; i++) {
- if (bufmgr->use_hal_tbm) {
- size = hal_tbm_bo_get_size((hal_tbm_bo *)surf->bos[i]->bo_data, (hal_tbm_error *)&error);
- if (error != TBM_ERROR_NONE)
- TBM_WRN("fail to get the size of bo.");
- } else if (bufmgr->backend_module_data) {
- size = bufmgr->bo_func->bo_get_size(surf->bos[i]->bo_data, &error);
- if (error != TBM_ERROR_NONE)
- TBM_WRN("fail to get the size of bo.");
- } else
- size = bufmgr->backend->bo_size(surf->bos[i]);
+ size = tbm_module_bo_get_size(bufmgr->module, surf->bos[i], surf->bos[i]->bo_data, &error);
+ if (error != TBM_ERROR_NONE)
+ TBM_WRN("fail to get the size of bo.");
TBM_SNRPRINTF(str, len, c, " bo:%-12p %-26d%-10d\n",
surf->bos[i],
surf->bos[i]->ref_cnt,
tbm_key key = 0;
LIST_FOR_EACH_ENTRY(bo, &bufmgr->bo_list, item_link) {
+ size = tbm_module_bo_get_size(bufmgr->module, bo, bo->bo_data, &error);
+ if (error != TBM_ERROR_NONE)
+ TBM_WRN("fail to get the size of bo.");
+
if (bo->bufmgr->use_hal_tbm) {
- size = hal_tbm_bo_get_size((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)&error);
- if (error != TBM_ERROR_NONE)
- TBM_WRN("fail to get the size of bo.");
key = (tbm_key)hal_tbm_bo_export_key((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)&error);
} else if (bufmgr->backend_module_data) {
- size = bufmgr->bo_func->bo_get_size(bo->bo_data, &error);
- if (error != TBM_ERROR_NONE)
- TBM_WRN("fail to get the size of bo.");
key = bufmgr->bo_func->bo_export_key(bo->bo_data, &error);
if (error != TBM_ERROR_NONE)
TBM_WRN("fail to get the tdm_key of bo.");
} else {
- size = bufmgr->backend->bo_size(bo);
key = bufmgr->backend->bo_export(bo);
}
TBM_SNRPRINTF(str, len, c, "%-3d %-11p %-5d %-7d %-6d %-5u %-7d %-11p %-4d\n",
tbm_backend_bo_data *tbm_module_bufmgr_bo_import_key(tbm_module *module, tbm_bo bo, tbm_key key, tbm_error_e *error);
void tbm_module_bo_free(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int get_from_hal_surface);
+int tbm_module_bo_get_size(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);
#endif /* _TBM_BUFMGR_INT_H_ */
/* LCOV_EXCL_STOP */
}
}
+
+int
+tbm_module_bo_get_size(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error)
+{
+ tbm_backend_bo_func *bo_func = NULL;
+ tbm_bufmgr_backend backend = NULL;
+ int size = 0;
+
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(module, 0, *error, TBM_ERROR_INVALID_PARAMETER);
+
+ switch (module->type) {
+ case TBM_MODULE_TYPE_HAL_TBM:
+ size = hal_tbm_bo_get_size((hal_tbm_bo *)bo_data, (hal_tbm_error *)error);
+ break;
+/* LCOV_EXCL_START */
+ case TBM_MODULE_TYPE_TBM_BACKEND:
+ bo_func = module->bo_func;
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(bo_func, 0, *error, TBM_ERROR_INVALID_OPERATION);
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(bo_func->bo_get_size, 0, *error, TBM_ERROR_NOT_SUPPORTED);
+
+ size = bo_func->bo_get_size(bo_data, error);
+ break;
+ case TBM_MODULE_TYPE_BUFMGR_BACKEND:
+ TBM_WRN("!!WARNING: This backend interface will be DEPRECATED after Tizen 6.5.");
+ backend = module->backend;
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(backend, 0, *error, TBM_ERROR_INVALID_OPERATION);
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(backend->bo_size, 0, *error, TBM_ERROR_NOT_SUPPORTED);
+
+ size = backend->bo_size(bo);
+ if (size == 0)
+ *error = TBM_ERROR_INVALID_OPERATION;
+ else
+ *error = TBM_ERROR_NONE;
+ break;
+ default:
+ TBM_ERR("Wrong module type:%d", module->type);
+ *error = TBM_ERROR_INVALID_OPERATION;
+ break;
+/* LCOV_EXCL_STOP */
+ }
+
+ return size;
+}