From: Changyeon Lee Date: Wed, 20 Jan 2016 11:15:27 +0000 (+0900) Subject: If owner of gbufmgr fd isn't frontend, don't dup2 fd X-Git-Tag: accepted/tizen/mobile/20160122.032757^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b653ec529b1b90a663e34e645d4a6e1f102e3eee;p=platform%2Fcore%2Fuifw%2Flibtbm.git If owner of gbufmgr fd isn't frontend, don't dup2 fd Change-Id: I320b65e8f029bc99ca2dba55fb6eb82632369934 Signed-off-by: Changyeon Lee --- diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index 90944a9..1c76a93 100755 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -817,17 +817,18 @@ tbm_bufmgr tbm_bufmgr_init(int fd) /* initialize buffer manager */ if (gBufMgr) { DBG("[libtbm:%d] use previous gBufMgr\n", getpid()); - - if (fd >= 0) { - if (dup2(gBufMgr->fd, fd) < 0) { - _tbm_set_last_result(TBM_BO_ERROR_DUP_FD_FAILED); - DBG("[libtbm:%d] Fail to duplicate(dup2) the drm fd\n", - getpid()); - pthread_mutex_unlock(&gLock); - return NULL; + if (!gBufMgr->fd_flag) { + if (fd >= 0) { + if (dup2(gBufMgr->fd, fd) < 0) { + _tbm_set_last_result(TBM_BO_ERROR_DUP_FD_FAILED); + TBM_LOG("[libtbm:%d] Fail to duplicate(dup2) the drm fd\n", + getpid()); + pthread_mutex_unlock(&gLock); + return NULL; + } + DBG("[libtbm:%d] duplicate the drm_fd(%d), new drm_fd(%d).\n", + getpid(), gBufMgr->fd, fd); } - DBG("[libtbm:%d] duplicate the drm_fd(%d), new drm_fd(%d).\n", - getpid(), gBufMgr->fd, fd); } gBufMgr->ref_count++;