tbm_bufmgr: add tbm_bufmgr_internal_support_capabilites 95/260995/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 7 Jul 2021 04:53:11 +0000 (13:53 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 8 Jul 2021 06:50:16 +0000 (15:50 +0900)
this function checks if the bufmgr has the given capabilites at the same
time.

Change-Id: I099dc2145e7e7bb01ed2acfe49e1a134f0058b0c

src/tbm_bufmgr.c
src/tbm_bufmgr_int.h

index f7ca118..a084cbf 100644 (file)
@@ -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 */
index 97ae0e5..91f411e 100644 (file)
@@ -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_ */