tbm_module: add tbm_surface_data_free 96/260296/1
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 22 Jun 2021 02:17:31 +0000 (11:17 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 22 Jun 2021 02:17:31 +0000 (11:17 +0900)
This frees tbm_surface_data resource.

Change-Id: I2b54f218f08ed2cb63f7a651539ccb8334ff34ee

src/tbm_module.c
src/tbm_module.h

index 66489e1..8bd834c 100644 (file)
@@ -882,6 +882,21 @@ tbm_module_import_bo_data_with_key(tbm_module *module, tbm_bo bo, tbm_key key, t
 }
 
 void
+tbm_surface_data_free(tbm_backend_surface_data *surface_data)
+{
+       TBM_RETURN_IF_FAIL(surface_data);
+       TBM_RETURN_IF_FAIL(surface_data->module);
+       TBM_RETURN_IF_FAIL(surface_data->module->type == TBM_MODULE_TYPE_HAL_TBM);
+
+       surface_data->module = NULL;
+
+       hal_tbm_surface_free(surface_data->hal_surface);
+       surface_data->hal_surface = NULL;
+
+       free(surface_data);
+}
+
+void
 tbm_module_bo_free(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int get_from_hal_surface)
 {
        tbm_backend_bo_func *bo_func = NULL;
index db0a295..da920a8 100644 (file)
@@ -90,6 +90,8 @@ tbm_backend_bo_data *tbm_module_alloc_bo_data_with_format(tbm_module *module, in
 tbm_backend_bo_data *tbm_module_import_bo_data_with_fd(tbm_module *module, tbm_bo bo, tbm_fd fd, tbm_error_e *error);
 tbm_backend_bo_data *tbm_module_import_bo_data_with_key(tbm_module *module, tbm_bo bo, tbm_key key, tbm_error_e *error);
 
+void                      tbm_surface_data_free(tbm_backend_surface_data *surface_data);
+
 void          tbm_module_bo_free(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, int get_from_hal_surface);
 int           tbm_module_bo_get_size(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);
 int           tbm_module_bo_get_memory_types(tbm_module *module, tbm_bo bo, tbm_backend_bo_data *bo_data, tbm_error_e *error);