tbm_backend: fix the handle casting. 07/259707/2
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 11 Jun 2021 06:32:28 +0000 (15:32 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 11 Jun 2021 07:23:39 +0000 (07:23 +0000)
use tbm_modlue instead of tbm_bufmgr in libtbm because of refactoring of tbm_module.

Change-Id: I600299e09eef8facbbc9b7d4c5dbfd10bc70f540

src/tbm_backend.c

index 4c9ce19..4da842c 100644 (file)
@@ -95,7 +95,10 @@ tbm_backend_bufmgr_register_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_fu
        TBM_RETURN_VAL_IF_FAIL(bufmgr, TBM_ERROR_INVALID_PARAMETER);
        TBM_RETURN_VAL_IF_FAIL(func, TBM_ERROR_INVALID_PARAMETER);
 
-       bufmgr->bufmgr_func = func;
+       // The tbm_bufmgr from backend module is actually tbm_module memory in libtbm.
+       // libtbm initializes module init with this tbm_module which is casted with tbm_bufmgr.
+       tbm_module *module = (tbm_module *)bufmgr;
+       module->bufmgr_func = func;
 
        return TBM_ERROR_NONE;
 }
@@ -134,7 +137,10 @@ tbm_backend_bufmgr_register_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func
        TBM_RETURN_VAL_IF_FAIL(bufmgr, TBM_ERROR_INVALID_PARAMETER);
        TBM_RETURN_VAL_IF_FAIL(func, TBM_ERROR_INVALID_PARAMETER);
 
-       bufmgr->bo_func = func;
+       // The tbm_bufmgr from backend module is actually tbm_module memory in libtbm.
+       // libtbm initializes module init with this tbm_module which is casted with tbm_bufmgr.
+       tbm_module *module = (tbm_module *)bufmgr;
+       module->bo_func = func;
 
        return TBM_ERROR_NONE;
 }