tbm_module: remove bufmgr variable at tbm_module
[platform/core/uifw/libtbm.git] / src / tbm_module.c
index fe90662..ae8e848 100644 (file)
@@ -53,45 +53,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* LCOV_EXCL_START */
 
-static void
-_tbm_module_copy_data_to_bufmgr(tbm_module *module, tbm_bufmgr bufmgr, int reset)
-{
-       if (!reset) {
-               bufmgr->module_data = module->module_data;
-               bufmgr->backend = module->backend;
-
-               bufmgr->backend_module_data = module->backend_module_data;
-               bufmgr->bufmgr_data = module->bufmgr_data;
-               bufmgr->bufmgr_func = module->bufmgr_func;
-               bufmgr->bo_func = module->bo_func;
-
-               bufmgr->use_hal_tbm = module->use_hal_tbm;
-               bufmgr->auth_wl_socket_created = module->auth_wl_socket_created;
-               bufmgr->auth_fd = module->auth_fd;
-               bufmgr->hal_backend = module->hal_backend;
-               bufmgr->hal_bufmgr = module->hal_bufmgr;
-       } else {
-               bufmgr->module_data = NULL;
-               bufmgr->backend = NULL;
-
-               bufmgr->backend_module_data = NULL;
-               bufmgr->bufmgr_data = NULL;
-               bufmgr->bufmgr_func = NULL;
-               bufmgr->bo_func = NULL;
-
-               bufmgr->use_hal_tbm = 0;
-               bufmgr->auth_wl_socket_created = 0;
-               bufmgr->auth_fd = -1;
-               bufmgr->hal_backend = NULL;
-               bufmgr->hal_bufmgr = NULL;
-       }
-}
-
 static int
 _tbm_backend_load_hal_tbm(tbm_module *module)
 {
        hal_tbm_backend *hal_backend = NULL;
-       hal_tbm_bufmgr_capability capability;
        hal_tbm_bufmgr *hal_bufmgr;
        hal_tbm_error ret = HAL_TBM_ERROR_NONE;
        hal_tbm_fd auth_drm_fd = -1;
@@ -138,25 +103,6 @@ _tbm_backend_load_hal_tbm(tbm_module *module)
                tbm_drm_helper_set_fd(auth_drm_fd);
        }
 
-       capability = hal_tbm_bufmgr_get_capabilities(hal_bufmgr, &ret);
-       if (ret != HAL_TBM_ERROR_NONE) {
-               TBM_ERR("hal_tbm_bufmgr_get_capabilities fail.");
-               goto get_backend_fail;
-       }
-
-       if (capability == HAL_TBM_BUFMGR_CAPABILITY_NONE) {
-               TBM_ERR("The capabilities of the backend module is TBM_BUFMGR_CAPABILITY_NONE.");
-               TBM_ERR("TBM_BUFMGR_CAPABILITY_SHARE_FD is the essential capability.");
-               goto get_backend_fail;
-       }
-       if (!(capability & HAL_TBM_BUFMGR_CAPABILITY_SHARE_FD)) {
-               TBM_ERR("The capabilities of the backend module had no TBM_BUFMGR_CAPABILITY_SHARE_FD.");
-               TBM_ERR("The tbm backend has to get TBM_BUFMGR_CAPABILITY_SHARE_FD. ");
-               goto get_backend_fail;
-       }
-
-       module->bufmgr->capabilities = capability;
-
        module->hal_backend = hal_backend;
        module->hal_bufmgr = hal_bufmgr;
 
@@ -318,20 +264,6 @@ _tbm_backend_load_module(tbm_module *module, const char *file)
                goto err;
        }
 
-       /* get the capability */
-       module->bufmgr->capabilities = module->bufmgr->bufmgr_func->bufmgr_get_capabilities(bufmgr_data, &error);
-       if (module->bufmgr->capabilities == TBM_BUFMGR_CAPABILITY_NONE) {
-               TBM_ERR("The capabilities of the backend module is TBM_BUFMGR_CAPABILITY_NONE.");
-               TBM_ERR("TBM_BUFMGR_CAPABILITY_SHARE_FD is the essential capability.");
-               goto err;
-       }
-
-       if (!(module->bufmgr->capabilities & TBM_BUFMGR_CAPABILITY_SHARE_FD)) {
-               TBM_ERR("The capabilities of the backend module had no TBM_BUFMGR_CAPABILITY_SHARE_FD.");
-               TBM_ERR("The tbm backend has to get TBM_BUFMGR_CAPABILITY_SHARE_FD. ");
-               goto err;
-       }
-
        module->module_data = module_data;
        module->backend_module_data = backend_module_data;
        module->bufmgr_data = bufmgr_data;
@@ -413,7 +345,7 @@ err:
 /* LCOV_EXCL_STOP */
 
 tbm_module *
-tbm_module_load(tbm_bufmgr bufmgr, int fd)
+tbm_module_load(int fd)
 {
        tbm_module *module;
        struct dirent **namelist;
@@ -424,7 +356,6 @@ tbm_module_load(tbm_bufmgr bufmgr, int fd)
                TBM_ERR("fail to allocate the memory");
                return NULL;
        }
-       module->bufmgr = bufmgr;
 
        /* try to load the hal-tbm backend module */
        ret = _tbm_backend_load_hal_tbm(module);
@@ -447,7 +378,7 @@ tbm_module_load(tbm_bufmgr bufmgr, int fd)
                return module;
        }
 
-       /* load bufmgr priv from configured path */
+       /* load backend_module from configured path */
        n = scandir(BUFMGR_MODULE_DIR, &namelist, 0, alphasort);
        if (n < 0) {
                TBM_ERR("no files : %s\n", BUFMGR_MODULE_DIR);
@@ -481,9 +412,6 @@ tbm_module_load(tbm_bufmgr bufmgr, int fd)
        }
 
 done:
-       if (module)
-               _tbm_module_copy_data_to_bufmgr(module, module->bufmgr, 0);
-
        return module;
 }
 
@@ -526,9 +454,6 @@ tbm_module_unload(tbm_module *module)
                break;
        }
 
-       _tbm_module_copy_data_to_bufmgr(module, module->bufmgr, 1);
-       module->bufmgr = NULL;
-
        free(module);
 }
 
@@ -554,7 +479,7 @@ tbm_module_bufmgr_get_capabilities(tbm_module *module)
        }
 
        if (error != TBM_ERROR_NONE) {
-               TBM_ERR("fail to get capabilities of bufmgr");
+               TBM_ERR("fail to get capabilities of tbm_module_bufmgr");
                return 0;
        }