TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
- if (bo->bufmgr->use_hal_tbm) {
- ret = (hal_tbm_key)hal_tbm_bo_export_key((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)&error);
- if (!ret) {
- /* LCOV_EXCL_START */
- TBM_ERR("error: bo(%p) tbm_key(%d) error(%d)\n", bo, ret, error);
- _tbm_set_last_result(error);
- goto done;
- /* LCOV_EXCL_STOP */
- }
- } else if (bo->bufmgr->backend_module_data) {
- if (!bo->bufmgr->bo_func->bo_export_key) {
- /* LCOV_EXCL_START */
- _tbm_bufmgr_mutex_unlock();
- _tbm_set_last_result(TBM_ERROR_NOT_SUPPORTED);
- return 0;
- /* LCOV_EXCL_STOP */
- }
-
- ret = bo->bufmgr->bo_func->bo_export_key(bo->bo_data, &error);
- if (!ret) {
- /* LCOV_EXCL_START */
- TBM_ERR("error: bo(%p) tbm_key(%d) error(%d)\n", bo, ret, error);
- _tbm_set_last_result(error);
- goto done;
- /* LCOV_EXCL_STOP */
- }
- } else {
- if (!bo->bufmgr->backend->bo_export) {
- /* LCOV_EXCL_START */
- _tbm_bufmgr_mutex_unlock();
- _tbm_set_last_result(TBM_ERROR_NOT_SUPPORTED);
- return 0;
- /* LCOV_EXCL_STOP */
- }
-
- ret = bo->bufmgr->backend->bo_export(bo);
- if (!ret) {
- /* LCOV_EXCL_START */
- TBM_ERR("error: bo(%p) tbm_key(%d)\n", bo, ret);
- _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
- goto done;
- /* LCOV_EXCL_STOP */
- }
+ ret = tbm_module_bo_export_key(bo->bufmgr->module, bo, bo->bo_data, &error);
+ if (!ret) {
+ /* LCOV_EXCL_START */
+ TBM_ERR("tbm_moule_bo_export_key failed. bo:%p tbm_key:%d error:%d", bo, ret, error);
+ _tbm_set_last_result(error);
+ _tbm_bufmgr_mutex_unlock();
+ return ret;
+ /* LCOV_EXCL_STOP */
}
- TBM_TRACE_BO("bo(%p) tbm_key(%u)\n", bo, ret);
+ TBM_TRACE_BO("bo:%p tbm_key:%u", bo, ret);
-done:
_tbm_bufmgr_mutex_unlock();
return ret;
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) {
- key = (tbm_key)hal_tbm_bo_export_key((hal_tbm_bo *)bo->bo_data, (hal_tbm_error *)&error);
- } else if (bufmgr->backend_module_data) {
- 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 {
- key = bufmgr->backend->bo_export(bo);
- }
+ key = tbm_module_bo_export_key(bufmgr->module, bo, bo->bo_data, &error);
+ if (error != TBM_ERROR_NONE)
+ TBM_WRN("fail to get the tdm_key of bo.");
TBM_SNRPRINTF(str, len, c, "%-3d %-11p %-5d %-7d %-6d %-5u %-7d %-11p %-4d\n",
++bo_cnt,
bo,
tbm_error_e tbm_module_bo_lock(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int device, int opt);
tbm_error_e tbm_module_bo_unlock(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data);
tbm_fd tbm_module_bo_export_fd(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);
+tbm_key tbm_module_bo_export_key(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);
#endif /* _TBM_BUFMGR_INT_H_ */
return fd;
}
+
+tbm_key
+tbm_module_bo_export_key(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;
+ tbm_key ret;
+
+ TBM_RETURN_VAL_SET_ERR_IF_FAIL(module, 0, *error, TBM_ERROR_INVALID_PARAMETER);
+
+ switch (module->type) {
+ case TBM_MODULE_TYPE_HAL_TBM:
+ ret = (hal_tbm_fd)hal_tbm_bo_export_key((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_export_key, 0, *error, TBM_ERROR_NOT_SUPPORTED);
+
+ ret = bo_func->bo_export_key(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_export, 0, *error, TBM_ERROR_NOT_SUPPORTED);
+
+ ret = backend->bo_export(bo);
+ if (!ret)
+ *error = TBM_ERROR_INVALID_OPERATION;
+ else
+ *error = TBM_ERROR_NONE;
+ break;
+ default:
+ TBM_ERR("Wrong module type:%d", module->type);
+ ret = -1;
+ *error = TBM_ERROR_INVALID_OPERATION;
+ break;
+/* LCOV_EXCL_STOP */
+ }
+
+ return ret;
+}
\ No newline at end of file