fix the memory allocation failed. 81/255581/1 accepted/tizen/unified/20210324.124652 submit/tizen/20210319.090109 submit/tizen/20210319.090617 submit/tizen/20210323.100158
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 19 Mar 2021 08:52:57 +0000 (17:52 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 19 Mar 2021 08:52:57 +0000 (17:52 +0900)
libtbm must calls tbm_bo_alloc function when tbm_bo_alloc_with_format is not supported at the backend module.

Change-Id: Ie2c3e161b278b88c724d2be7023399895574298b

src/tbm_surface_internal.c

index 0618fe4..17aa777 100644 (file)
@@ -852,13 +852,11 @@ tbm_surface_internal_create_with_flags(int width, int height,
                if (bufmgr->use_hal_tbm) {
                        surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, surf->info.bpp/8, flags, &error);
                        if (error == TBM_ERROR_NOT_SUPPORTED) {
-                               if (error != TBM_ERROR_NONE) {
+                               surf->bos[i] = tbm_bo_alloc(bufmgr, bo_size, flags);
+                               if (!surf->bos[i]) {
                                        TBM_ERR("fail to alloc bo idx:%d\n", i);
                                        goto alloc_bo_fail;
                                }
-                       } else if (error != TBM_ERROR_NONE) {
-                               TBM_ERR("fail to alloc bo idx:%d\n", i);
-                               goto alloc_bo_fail;
                        }
                } else if (bufmgr->backend_module_data) {
                        if (bufmgr->bufmgr_func->bufmgr_alloc_bo_with_format) {