From c02cc428b689e851876c097903008322622d223a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 7 Jul 2021 13:53:11 +0900 Subject: [PATCH] tbm_bufmgr: add tbm_bufmgr_internal_support_capabilites this function checks if the bufmgr has the given capabilites at the same time. Change-Id: I099dc2145e7e7bb01ed2acfe49e1a134f0058b0c --- src/tbm_bufmgr.c | 21 +++++++++++++++++++++ src/tbm_bufmgr_int.h | 1 + 2 files changed, 22 insertions(+) diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index f7ca118..a084cbf 100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -1165,4 +1165,25 @@ failed: return NULL; } +int +tbm_bufmgr_internal_support_capabilites(tbm_bufmgr bufmgr, int capabilities) +{ + TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), 0); + TBM_BUFMGR_RETURN_VAL_IF_FAIL(capabilities > 0, 0); + + _tbm_bufmgr_mutex_lock(); + + // check if the bufmgr does not support capabilities at the same time. + if (!(bufmgr->capabilities & capabilities)) { + _tbm_set_last_result(TBM_ERROR_NOT_SUPPORTED); + _tbm_bufmgr_mutex_unlock(); + return 0; + } + + _tbm_set_last_result(TBM_ERROR_NONE); + _tbm_bufmgr_mutex_unlock(); + + return 1; +} + /* LCOV_EXCL_STOP */ diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index 97ae0e5..91f411e 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -312,5 +312,6 @@ tbm_bo tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, i 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_bo tbm_bufmgr_internal_import_bo_with_fd(tbm_bufmgr bufmgr, tbm_fd fd); +int tbm_bufmgr_internal_support_capabilites(tbm_bufmgr bufmgr, int capabilities); #endif /* _TBM_BUFMGR_INT_H_ */ -- 2.34.1