From: SooChan Lim Date: Thu, 10 Jun 2021 06:47:23 +0000 (+0900) Subject: tbm_bufmgr: use tbm_module_bufmgr_get_capabilities X-Git-Tag: submit/tizen/20210611.072439~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibtbm.git;a=commitdiff_plain;h=c06452c54dade3ea445b9a4feffc05a404dbd786 tbm_bufmgr: use tbm_module_bufmgr_get_capabilities Use tbm_module_bufmgr_get_capabilities and remove the code for getting capabilities at tbm_module.c Change-Id: Iff76fa966f202a1a28e2a518733ba7901e43b490 --- diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index 703cf40..38ec943 100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -244,6 +244,31 @@ _tbm_bufmgr_init(int fd, int server) return NULL; } + + /* check the essential capabilities of tbm_module */ + gBufMgr->capabilities = tbm_module_bufmgr_get_capabilities(gBufMgr->module); + if (gBufMgr->capabilities == 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."); + tbm_module_unload(gBufMgr->module); + _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION); + free(gBufMgr); + gBufMgr = NULL; + pthread_mutex_unlock(&gLock); + return NULL; + } + + if (!(gBufMgr->capabilities & 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. "); + tbm_module_unload(gBufMgr->module); + _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION); + free(gBufMgr); + gBufMgr = NULL; + pthread_mutex_unlock(&gLock); + return NULL; + } + /* LCOV_EXCL_STOP */ gBufMgr->ref_count = 1; diff --git a/src/tbm_module.c b/src/tbm_module.c index fe90662..10e7eff 100644 --- a/src/tbm_module.c +++ b/src/tbm_module.c @@ -91,7 +91,6 @@ 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 +137,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 +298,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;