#define TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(cond, val, error, error_type) {\
if (!(cond)) {\
TBM_ERR("'%s' failed.\n", #cond);\
- error = error_type;\
+ if (error)\
+ *error = error_type;\
_tbm_set_last_result(error_type);\
_tbm_surface_mutex_unlock();\
return val;\
bo_size += surf->info.planes[j].size;
}
- surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, surf->info.bpp/8, flags, error);
+ surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_format(bufmgr, format, i, width, height, surf->info.bpp/8, flags, error);
if (!surf->bos[i]) {
surf->bos[i] = tbm_bo_alloc(bufmgr, bo_size, flags);
if (!surf->bos[i]) {
}
for (i = 0; i < num_bos; i++) {
- surf->bos[i] = tbm_bo_alloc_with_bo_data(bufmgr, (tbm_backend_bo_data *)hal_bos[i], flags);
+ surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_bo_data(bufmgr, (tbm_backend_bo_data *)hal_bos[i], flags);
if (!surf->bos[i]) {
TBM_ERR("fail to alloc bo idx:%d", i);
*error = tbm_get_last_error();
bo_size += surf->info.planes[j].size;
}
- surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, surf->info.bpp / 8, flags, error);
+ surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_format(bufmgr, format, i, width, height, surf->info.bpp / 8, flags, error);
if (*error == TBM_ERROR_NOT_SUPPORTED) {
surf->bos[i] = tbm_bo_alloc(bufmgr, bo_size, flags);
if (!surf->bos[i]) {
}
// import surface
- hal_surface = hal_tbm_bufmgr_import_surface(bufmgr->hal_bufmgr,
+ hal_surface = hal_tbm_bufmgr_import_surface(bufmgr->hal_bufmgr,
(uint32_t)width,
(uint32_t)height,
(hal_tbm_format)format,
surf->flags = flags;
for (i = 0; i < num_bos; i++) {
- surf->bos[i] = tbm_bo_alloc_with_bo_data(bufmgr, (tbm_backend_bo_data *)hal_bos[i], flags);
+ surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_bo_data(bufmgr, (tbm_backend_bo_data *)hal_bos[i], flags);
if (!surf->bos[i]) {
TBM_ERR("fail to alloc bo idx:%d", i);
*error = tbm_get_last_error();
_tbm_bo_set_surface(surf->bos[i], surf);
}
- *error = TBM_ERROR_NONE;
-
return surf;
get_bo_fail:
+ for (j = 0; j < i; j++) {
+ if (surf->bos[j])
+ tbm_bo_unref(surf->bos[j]);
+ }
get_memory_types_fail:
get_bos_fail:
query_plane_data_fail:
- if (hal_surface) {
- hal_tbm_surface_free(hal_surface);
- } else {
- for (j = 0; j < i; j++) {
- if (surf->bos[j])
- tbm_bo_unref(surf->bos[j]);
- }
- }
+ hal_tbm_surface_free(hal_surface);
import_surface_fail:
num_planes_fail:
bpp_fail:
_tbm_surface_mutex_lock();
surf = (struct _tbm_surface *)surface;
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(_tbm_surface_internal_is_valid(surface), NULL, *error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(_tbm_surface_internal_is_valid(surface), NULL, error, TBM_ERROR_INVALID_PARAMETER);
bufmgr = surf->bufmgr;
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr != NULL, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr != NULL, NULL, error, TBM_ERROR_INVALID_PARAMETER);
// this function supports when it comes to be use_hal.
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr->use_hal_tbm, NULL, *error, TBM_ERROR_NOT_SUPPORTED);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr->use_hal_tbm, NULL, error, TBM_ERROR_NOT_SUPPORTED);
// export a surface
buffer_data = (tbm_surface_buffer_data *)hal_tbm_surface_export((hal_tbm_surface *)surf->hal_surface,
TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) buffer_data(%p)", surface, buffer_data);
- if (error)
- *error = TBM_ERROR_NONE;
-
_tbm_set_last_result(TBM_ERROR_NONE);
_tbm_surface_mutex_unlock();
_tbm_surface_mutex_lock();
bufmgr = g_surface_bufmgr;
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr != NULL, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr != NULL, NULL, error, TBM_ERROR_INVALID_PARAMETER);
// this function supports when it comes to be use_hal.
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr->use_hal_tbm, NULL, *error, TBM_ERROR_NOT_SUPPORTED);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr->use_hal_tbm, NULL, error, TBM_ERROR_NOT_SUPPORTED);
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(surface_info != NULL, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(surface_info->width > 0, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(surface_info->height > 0, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
- TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(buffer_data != NULL, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(surface_info != NULL, NULL, error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(surface_info->width > 0, NULL, error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(surface_info->height > 0, NULL, error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(buffer_data != NULL, NULL, error, TBM_ERROR_INVALID_PARAMETER);
// import a surface
surf = _tbm_surface_internal_hal_tbm_import_surface(bufmgr,
TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p)", surf);
- if (error)
- *error = TBM_ERROR_NONE;
-
_tbm_set_last_result(TBM_ERROR_NONE);
_tbm_surface_mutex_unlock();