} \
}
+#define TBM_BUFMGR_RETURN_VAL_SET_ERR_IF_FAIL(cond, val, error, error_type) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.\n", #cond);\
+ error = error_type;\
+ _tbm_bufmgr_mutex_unlock();\
+ return val;\
+ } \
+}
+
/* LCOV_EXCL_START */
static void
}
tbm_bo
-tbm_bufmgr_internal_alloc_bo_with_bo_data(tbm_bufmgr bufmgr, tbm_bo_data *bo_data, int flags)
+tbm_bufmgr_internal_alloc_bo_with_bo_data(tbm_bufmgr bufmgr, tbm_bo_data *bo_data, int flags, tbm_error_e *error)
{
tbm_bo bo, bo2 = NULL;
_tbm_bufmgr_mutex_lock();
- _tbm_set_last_result(TBM_ERROR_NONE);
- TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL);
- TBM_BUFMGR_RETURN_VAL_IF_FAIL(bo_data, NULL);
+ *error = TBM_ERROR_NONE;
+
+ TBM_BUFMGR_RETURN_VAL_SET_ERR_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL, *error, TBM_ERROR_INVALID_PARAMETER);
+ TBM_BUFMGR_RETURN_VAL_SET_ERR_IF_FAIL(bo_data, NULL, *error, TBM_ERROR_INVALID_PARAMETER);
_tbm_bufmgr_check_bo_cnt(bufmgr);
if (!bo) {
/* LCOV_EXCL_START */
TBM_ERR("memory allocationc failed.");
- _tbm_set_last_result(TBM_ERROR_OUT_OF_MEMORY);
+ *error = TBM_ERROR_OUT_OF_MEMORY;
_tbm_bufmgr_mutex_unlock();
return NULL;
/* LCOV_EXCL_STOP */
tbm_bo tbm_bufmgr_internal_alloc_bo(tbm_bufmgr bufmgr, int size, int flags, tbm_error_e *error);
tbm_bo tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_idx, int width, int bpp, int height, tbm_bo_memory_type flags, tbm_error_e *error);
-tbm_bo tbm_bufmgr_internal_alloc_bo_with_bo_data(tbm_bufmgr bufmgr, tbm_bo_data *bo_data, int flags);
+tbm_bo tbm_bufmgr_internal_alloc_bo_with_bo_data(tbm_bufmgr bufmgr, tbm_bo_data *bo_data, int flags, tbm_error_e *error);
tbm_bo tbm_bufmgr_internal_import_bo_with_key(tbm_bufmgr bufmgr, tbm_key key, tbm_error_e *error);
tbm_bo tbm_bufmgr_internal_import_bo_with_fd(tbm_bufmgr bufmgr, tbm_fd fd, tbm_error_e *error);
}
for (i = 0; i < num_bos; i++) {
- surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_bo_data(bufmgr, bo_data_array[i], flags);
+ surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_bo_data(bufmgr, bo_data_array[i], flags, error);
if (!surf->bos[i]) {
TBM_ERR("fail to alloc bo idx:%d", i);
- *error = tbm_get_last_error();
goto get_bo_fail;
}
surf->flags = flags;
for (i = 0; i < num_bos; i++) {
- surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_bo_data(bufmgr, bo_data_array[i], flags);
+ surf->bos[i] = tbm_bufmgr_internal_alloc_bo_with_bo_data(bufmgr, bo_data_array[i], flags, error);
if (!surf->bos[i]) {
TBM_ERR("fail to alloc bo idx:%d", i);
- *error = tbm_get_last_error();
goto get_bo_fail;
}