bo->lock_cnt--;
}
- /* call the bo_free */
- if (bo->bufmgr->use_hal_tbm) {
- // call hal_tbm_bo_free when bo is created by tbm_bo_alloc api.
- if (!bo->get_from_hal_surface) {
- bo->get_from_hal_surface = 0;
-
- hal_tbm_bo_free(bo->bo_data);
- bo->bo_data = NULL;
- }
- } else if (bo->bufmgr->backend_module_data) {
- bo->bufmgr->bo_func->bo_free(bo->bo_data);
- bo->bo_data = NULL;
- } else {
- bo->bufmgr->backend->bo_free(bo);
- bo->priv = NULL;
- }
+ tbm_module_bo_free(bo->bufmgr->module, bo, bo->bo_data, bo->get_from_hal_surface);
_tbm_bo_deinit(bo);
tbm_backend_bo_data *tbm_module_bufmgr_bo_import_fd(tbm_module *module, tbm_bo bo, tbm_fd fd, tbm_error_e *error);
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);
+
#endif /* _TBM_BUFMGR_INT_H_ */
return bo_data;
}
+
+void
+tbm_module_bo_free(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int get_from_hal_surface)
+{
+ tbm_backend_bo_func *bo_func = NULL;
+ tbm_bufmgr_backend backend = NULL;
+
+ TBM_RETURN_IF_FAIL(module);
+ TBM_RETURN_IF_FAIL(bo);
+ TBM_RETURN_IF_FAIL(bo_data);
+
+ switch (module->type) {
+ case TBM_MODULE_TYPE_HAL_TBM:
+ // call hal_tbm_bo_free when bo is created by tbm_bo_alloc api.
+ if (get_from_hal_surface)
+ hal_tbm_bo_free(bo_data);
+ break;
+/* LCOV_EXCL_START */
+ case TBM_MODULE_TYPE_TBM_BACKEND:
+ bo_func = module->bo_func;
+ TBM_RETURN_IF_FAIL(bo_func);
+ TBM_RETURN_IF_FAIL(bo_func->bo_free);
+
+ bo_func->bo_free(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_IF_FAIL(backend);
+ TBM_RETURN_IF_FAIL(backend->bo_free);
+
+ backend->bo_free(bo);
+ break;
+ default:
+ TBM_ERR("Wrong module type:%d", module->type);
+ break;
+/* LCOV_EXCL_STOP */
+ }
+}