int
tbm_bo_unmap(tbm_bo bo)
{
- int ret = 1;
tbm_error_e error;
_tbm_bufmgr_mutex_lock();
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
TBM_BO_RETURN_VAL_IF_FAIL(bo->map_cnt > 0, 0);
- if (bo->bufmgr->use_hal_tbm) {
- error = (hal_tbm_error)hal_tbm_bo_unmap((hal_tbm_bo *)bo->bo_data);
- if (error != TBM_ERROR_NONE) {
- /* LCOV_EXCL_START */
- TBM_ERR("error: bo(%p) map_cnt(%d) error(%d)\n", bo, bo->map_cnt, error);
- _tbm_set_last_result(error);
- ret = 0;
- goto done;
- /* LCOV_EXCL_STOP */
- }
- } else if (bo->bufmgr->backend_module_data) {
- error = bo->bufmgr->bo_func->bo_unmap(bo->bo_data);
- if (error != TBM_ERROR_NONE) {
- /* LCOV_EXCL_START */
- TBM_ERR("error: bo(%p) map_cnt(%d) error(%d)\n", bo, bo->map_cnt, error);
- _tbm_set_last_result(error);
- ret = 0;
- goto done;
- /* LCOV_EXCL_STOP */
- }
- } else {
- ret = bo->bufmgr->backend->bo_unmap(bo);
- if (!ret) {
- /* LCOV_EXCL_START */
- TBM_ERR("error: bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
- _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
- goto done;
- /* LCOV_EXCL_STOP */
- }
+ error = tbm_module_bo_unmap(bo->bufmgr->module, bo, bo->bo_data);
+ if (error != TBM_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ TBM_ERR("error: bo(%p) map_cnt(%d) error(%d)\n", bo, bo->map_cnt, error);
+ _tbm_set_last_result(error);
+ _tbm_bufmgr_mutex_unlock();
+ return 0;
+ /* LCOV_EXCL_STOP */
}
/* decrease the map_count */
_tbm_bo_unlock(bo);
-done:
_tbm_bufmgr_mutex_unlock();
- return ret;
+ return 1;
}
tbm_bo_handle
int tbm_module_bo_get_memory_types(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);
tbm_bo_handle tbm_module_bo_get_handle(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int device, tbm_error_e *error);
tbm_bo_handle tbm_module_bo_map(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int device, int opt, tbm_error_e *error);
+tbm_error_e tbm_module_bo_unmap(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data);
#endif /* _TBM_BUFMGR_INT_H_ */
return bo_handle;
}
+
+tbm_error_e
+tbm_module_bo_unmap(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data)
+{
+ tbm_backend_bo_func *bo_func = NULL;
+ tbm_bufmgr_backend backend = NULL;
+ tbm_error_e error;
+ int ret = 0;
+
+ TBM_RETURN_VAL_IF_FAIL(module, TBM_ERROR_INVALID_PARAMETER);
+
+ switch (module->type) {
+ case TBM_MODULE_TYPE_HAL_TBM:
+ error = (hal_tbm_error)hal_tbm_bo_unmap((hal_tbm_bo *)bo_data);
+ break;
+/* LCOV_EXCL_START */
+ case TBM_MODULE_TYPE_TBM_BACKEND:
+ bo_func = module->bo_func;
+ TBM_RETURN_VAL_IF_FAIL(bo_func, TBM_ERROR_INVALID_OPERATION);
+ TBM_RETURN_VAL_IF_FAIL(bo_func->bo_unmap, TBM_ERROR_NOT_SUPPORTED);
+
+ error = bo_func->bo_unmap(bo->bo_data);
+ 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_IF_FAIL(backend, TBM_ERROR_INVALID_OPERATION);
+ TBM_RETURN_VAL_IF_FAIL(backend->bo_unmap, TBM_ERROR_NOT_SUPPORTED);
+
+ ret = bo->bufmgr->backend->bo_unmap(bo);
+ if (!ret)
+ 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 error;
+}