tbm_module : add tbm_module_bufmgr_get_capabilities 02/259702/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 10 Jun 2021 06:42:04 +0000 (15:42 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 11 Jun 2021 00:50:04 +0000 (09:50 +0900)
This function returns the capabilities of the bufmgr module.

Change-Id: I9279fe2b025e46526931e0c063993723410ce61e

src/tbm_bufmgr_int.h
src/tbm_module.c

index b19351b..fe9bc61 100644 (file)
@@ -358,4 +358,6 @@ tbm_bo tbm_bo_alloc_with_bo_data(tbm_bufmgr bufmgr, tbm_backend_bo_data *bo_data
 tbm_module *tbm_module_load(tbm_bufmgr bufmgr, int fd);
 void        tbm_module_unload(tbm_module *module);
 
-#endif /* _TBM_BUFMGR_INT_H_ */
+int         tbm_module_bufmgr_get_capabilities(tbm_module *module);
+
+#endif                                                 /* _TBM_BUFMGR_INT_H_ */
index eec0f34..fe90662 100644 (file)
@@ -532,3 +532,31 @@ tbm_module_unload(tbm_module *module)
        free(module);
 }
 
+int
+tbm_module_bufmgr_get_capabilities(tbm_module *module)
+{
+       tbm_error_e error = TBM_ERROR_NOT_SUPPORTED;
+       int capabilities = 0;
+
+       switch (module->type) {
+       case TBM_MODULE_TYPE_HAL_TBM:
+               capabilities = hal_tbm_bufmgr_get_capabilities(module->hal_bufmgr, (hal_tbm_error *)&error);
+               break;
+       case TBM_MODULE_TYPE_TBM_BACKEND:
+               capabilities = module->bufmgr_func->bufmgr_get_capabilities(module->bufmgr_data, &error);
+               break;
+       case TBM_MODULE_TYPE_BUFMGR_BACKEND:
+               TBM_ERR("Do not support at tbm_bufmgr_backend.");
+               break;
+       default:
+               TBM_ERR("Wrong module type:%d", module->type);
+               break;
+       }
+
+       if (error != TBM_ERROR_NONE) {
+               TBM_ERR("fail to get capabilities of bufmgr");
+               return 0;
+       }
+
+       return capabilities;
+}