X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ftbm_bufmgr_backend.c;h=87d3c78bbfc7209d861543723763be5e0576f7eb;hb=d470174e6839eacee9b4d9759c0aa414b671b188;hp=bcd6a06d8f80f3b475d1d0a91ec44532455e4834;hpb=8ef6843c0eeaf558005ce0272bcbb5ce58f77a7a;p=platform%2Fcore%2Fuifw%2Flibtbm.git diff --git a/src/tbm_bufmgr_backend.c b/src/tbm_bufmgr_backend.c index bcd6a06..87d3c78 100644 --- a/src/tbm_bufmgr_backend.c +++ b/src/tbm_bufmgr_backend.c @@ -37,13 +37,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "tbm_bufmgr_int.h" +/* LCOV_EXCL_START */ tbm_bufmgr_backend tbm_backend_alloc(void) { tbm_bufmgr_backend bufmgr_backend; bufmgr_backend = calloc(1, sizeof(struct _tbm_bufmgr_backend)); - if (!bufmgr_backend) + if (!bufmgr_backend) { + TBM_ERR("error: fail to allocate the bufmgr_backend\n"); return NULL; + } return bufmgr_backend; } @@ -59,36 +62,24 @@ void tbm_backend_free(tbm_bufmgr_backend 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_ERR("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_ERR("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; } @@ -121,9 +112,17 @@ int tbm_backend_is_display_server(void) { const char *value; - value = (const char*)getenv("TBM_DISPLAY_SERVER"); - if (!value) + if (gBufMgr == NULL) { + TBM_ERR("error: no gBufMgr.\n"); return 0; + } - return 1; + /* TODO: TBM_DISPLAY_SERVER will be removed */ + value = (const char*)getenv("TBM_DISPLAY_SERVER"); + + if (value || gBufMgr->display_server) + return 1; + + return 0; } +/* LCOV_EXCL_STOP */