#include <sys/types.h>
#include "tbm_bufmgr_int.h"
+/* LCOV_EXCL_START */
tbm_bufmgr_backend tbm_backend_alloc(void)
{
tbm_bufmgr_backend bufmgr_backend;
int tbm_backend_init(tbm_bufmgr bufmgr, tbm_bufmgr_backend backend)
{
- int flags = 0;
-
if (!bufmgr) {
- TBM_LOG("[libtbm:%d] "
- "error (%s): fail to init tbm backend... bufmgr is null\n", getpid(),
- __func__);
+ TBM_LOG_E("error: fail to init tbm backend... bufmgr is null\n");
return 0;
}
if (!backend) {
- TBM_LOG("[libtbm:%d] "
- "error (%s): fail to init tbm backend... backend is null\n", getpid(),
- __func__);
+ TBM_LOG_E("error: fail to init tbm backend... backend is null\n");
return 0;
}
- flags = backend->flags;
- /* check the backend flags */
- if (!(flags & TBM_USE_2_0_BACKEND)) {
- if (flags & TBM_CACHE_CTRL_BACKEND) {
- if (!backend->bo_cache_flush) {
- TBM_LOG("[libtbm:%d] "
- "error (%s): TBM_FLAG_CACHE_CTRL_TBM needs backend->bo_cache_flush\n", getpid(),
- __func__);
- return 0;
- }
- }
- }
-
bufmgr->backend = backend;
+ bufmgr->capabilities = TBM_BUFMGR_CAPABILITY_NONE;
+
+ if (bufmgr->backend->bo_import && bufmgr->backend->bo_export)
+ bufmgr->capabilities |= TBM_BUFMGR_CAPABILITY_SHARE_KEY;
+
+ if (bufmgr->backend->bo_import_fd && bufmgr->backend->bo_export_fd)
+ bufmgr->capabilities |= TBM_BUFMGR_CAPABILITY_SHARE_FD;
return 1;
}
return 1;
}
+/* LCOV_EXCL_STOP */