return bo2;
}
- // TODO: refactoring tbm_module_bo
- if (bufmgr->use_hal_tbm) {
- flags = (tbm_bo_memory_type)hal_tbm_bo_get_memory_types((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)error);
- if (*error != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the bo flags(memory_types)");
- flags = TBM_BO_DEFAULT;
- }
- } else if (bufmgr->backend_module_data) {
- flags = bufmgr->bo_func->bo_get_memory_types(bo->bo_data, error);
- if (error != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the bo flags(memory_types)");
- flags = TBM_BO_DEFAULT;
- }
- } else {
- if (bufmgr->backend->bo_get_flags)
- flags = bufmgr->backend->bo_get_flags(bo);
- else
- flags = TBM_BO_DEFAULT;
+ flags = tbm_module_bo_get_memory_types(bufmgr->module, bo, bo->bo_data, error);
+ if (*error != TBM_ERROR_NONE) {
+ TBM_ERR("fail to get the bo flags(memory_types)");
+ flags = TBM_BO_DEFAULT;
}
_tbm_bufmgr_initialize_bo(bufmgr, bo, flags);
return bo2;
}
- // TODO: refactoring tbm_module_bo
- if (bufmgr->use_hal_tbm) {
- flags = (tbm_bo_memory_type)hal_tbm_bo_get_memory_types((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)error);
- if (error != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the bo flags(memory_types)");
- flags = TBM_BO_DEFAULT;
- }
- } else if (bufmgr->backend_module_data) {
- flags = bufmgr->bo_func->bo_get_memory_types(bo->bo_data, error);
- if (error != TBM_ERROR_NONE) {
- TBM_ERR("fail to get the bo flags(memory_types)");
- flags = TBM_BO_DEFAULT;
- }
- } else {
- if (bufmgr->backend->bo_get_flags)
- flags = bufmgr->backend->bo_get_flags(bo);
- else
- flags = TBM_BO_DEFAULT;
+ flags = tbm_module_bo_get_memory_types(bufmgr->module, bo, bo->bo_data, error);
+ if (*error != TBM_ERROR_NONE) {
+ TBM_ERR("fail to get the bo flags(memory_types)");
+ flags = TBM_BO_DEFAULT;
}
_tbm_bufmgr_initialize_bo(bufmgr, bo, flags);
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);
+int tbm_module_bo_get_memory_types(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);
#endif /* _TBM_BUFMGR_INT_H_ */
return size;
}
+
+int
+tbm_module_bo_get_memory_types(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 memory_types = TBM_BO_DEFAULT;
+
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(module, 0, *error, TBM_ERROR_INVALID_PARAMETER);
+
+ switch (module->type) {
+ case TBM_MODULE_TYPE_HAL_TBM:
+ memory_types = (tbm_bo_memory_type)hal_tbm_bo_get_memory_types((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_memory_types, 0, *error, TBM_ERROR_NOT_SUPPORTED);
+
+ memory_types = bo_func->bo_get_memory_types(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_get_flags, 0, *error, TBM_ERROR_NOT_SUPPORTED);
+
+ memory_types = backend->bo_get_flags(bo);
+ *error = TBM_ERROR_NONE;
+ break;
+ default:
+ TBM_ERR("Wrong module type:%d", module->type);
+ *error = TBM_ERROR_INVALID_OPERATION;
+ break;
+/* LCOV_EXCL_STOP */
+ }
+
+ return memory_types;
+}