tbm_module: add tbm_module_bo_get_bo_handle and use it
[platform/core/uifw/libtbm.git] / src / tbm_bo.c
index 55c9581..2eb9213 100644 (file)
@@ -521,35 +521,14 @@ tbm_bo_get_handle(tbm_bo bo, int device)
 
        TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), (tbm_bo_handle) NULL);
 
-       if (bo->bufmgr->use_hal_tbm) {
-               hal_tbm_bo_handle hbo_handle;
-               hbo_handle = hal_tbm_bo_get_handle((hal_tbm_bo *)bo->bo_data, device, (hal_tbm_error *)&error);
-               if (hbo_handle.ptr == NULL) {
-                       /* LCOV_EXCL_START */
-                       TBM_ERR("error: bo(%p) bo_handle(%p) error(%d)\n", bo, hbo_handle.ptr, error);
-                       _tbm_set_last_result(error);
-                       goto bo_handle_fail;
-                       /* LCOV_EXCL_STOP */
-               }
-               memcpy(&bo_handle.ptr, &hbo_handle.ptr, sizeof(tbm_bo_handle));
-       } else if (bo->bufmgr->backend_module_data) {
-               bo_handle = bo->bufmgr->bo_func->bo_get_handle(bo->bo_data, device, &error);
-               if (bo_handle.ptr == NULL) {
-                       /* LCOV_EXCL_START */
-                       TBM_ERR("error: bo(%p) bo_handle(%p) error(%d)\n", bo, bo_handle.ptr, error);
-                       _tbm_set_last_result(error);
-                       goto bo_handle_fail;
-                       /* LCOV_EXCL_STOP */
-               }
-       } else {
-               bo_handle = bo->bufmgr->backend->bo_get_handle(bo, device);
-               if (bo_handle.ptr == NULL) {
-                       /* LCOV_EXCL_START */
-                       TBM_ERR("error: bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
-                       _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
-                       goto bo_handle_fail;
-                       /* LCOV_EXCL_STOP */
-               }
+       bo_handle = tbm_module_bo_get_handle(bo->bufmgr->module, bo, bo->bo_data, device, &error);
+       if (bo_handle.ptr == NULL) {
+               /* LCOV_EXCL_START */
+               TBM_ERR("error: bo(%p) bo_handle(%p) error(%d)\n", bo, bo_handle.ptr, error);
+               _tbm_set_last_result(error);
+               _tbm_bufmgr_mutex_unlock();
+               return (tbm_bo_handle)NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        TBM_TRACE_BO("bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
@@ -557,10 +536,6 @@ tbm_bo_get_handle(tbm_bo bo, int device)
        _tbm_bufmgr_mutex_unlock();
 
        return bo_handle;
-
-bo_handle_fail:
-       _tbm_bufmgr_mutex_unlock();
-       return (tbm_bo_handle) NULL;
 }
 
 tbm_key