} \
}
-enum {
- LOCK_TRY_ONCE,
- LOCK_TRY_ALWAYS,
- LOCK_TRY_NEVER
-};
-
static void
_tbm_set_last_result(tbm_error_e err)
{
bufmgr = bo->bufmgr;
/* do not try to lock the bo */
- if (bufmgr->lock_type == LOCK_TRY_NEVER)
+ if (bufmgr->bo_lock_type == TBM_BUFMGR_BO_LOCK_TYPE_NEVER)
return 1;
if (bo->lock_cnt < 0) {
old = bo->lock_cnt;
- switch (bufmgr->lock_type) {
- case LOCK_TRY_ONCE:
+ switch (bufmgr->bo_lock_type) {
+ case TBM_BUFMGR_BO_LOCK_TYPE_ONCE:
if (bo->lock_cnt == 0) {
_tbm_bufmgr_mutex_unlock();
ret = _bo_lock(bo, device, opt);
} else
ret = 1;
break;
- case LOCK_TRY_ALWAYS:
+ case TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS:
_tbm_bufmgr_mutex_unlock();
ret = _bo_lock(bo, device, opt);
_tbm_bufmgr_mutex_lock();
bo->lock_cnt++;
break;
default:
- TBM_LOG_E("error bo:%p lock_type[%d] is wrong.\n",
- bo, bufmgr->lock_type);
+ TBM_LOG_E("error bo:%p bo_lock_type[%d] is wrong.\n",
+ bo, bufmgr->bo_lock_type);
ret = 0;
break;
}
bufmgr = bo->bufmgr;
/* do not try to unlock the bo */
- if (bufmgr->lock_type == LOCK_TRY_NEVER)
+ if (bufmgr->bo_lock_type == TBM_BUFMGR_BO_LOCK_TYPE_NEVER)
return;
old = bo->lock_cnt;
- switch (bufmgr->lock_type) {
- case LOCK_TRY_ONCE:
+ switch (bufmgr->bo_lock_type) {
+ case TBM_BUFMGR_BO_LOCK_TYPE_ONCE:
if (bo->lock_cnt > 0) {
bo->lock_cnt--;
if (bo->lock_cnt == 0)
_bo_unlock(bo);
}
break;
- case LOCK_TRY_ALWAYS:
+ case TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS:
if (bo->lock_cnt > 0) {
bo->lock_cnt--;
_bo_unlock(bo);
}
break;
default:
- TBM_LOG_E("error bo:%p lock_type[%d] is wrong.\n",
- bo, bufmgr->lock_type);
+ TBM_LOG_E("error bo:%p bo_lock_type[%d] is wrong.\n",
+ bo, bufmgr->bo_lock_type);
break;
}
TBM_DBG("create tizen bufmgr:%p ref_count:%d\n",
gBufMgr, gBufMgr->ref_count);
- /* setup the lock_type */
+ /* setup the bo_lock_type */
env = getenv("BUFMGR_LOCK_TYPE");
if (env && !strcmp(env, "always"))
- gBufMgr->lock_type = LOCK_TRY_ALWAYS;
+ gBufMgr->bo_lock_type = TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS;
else if (env && !strcmp(env, "none"))
- gBufMgr->lock_type = LOCK_TRY_NEVER;
+ gBufMgr->bo_lock_type = TBM_BUFMGR_BO_LOCK_TYPE_NEVER;
else if (env && !strcmp(env, "once"))
- gBufMgr->lock_type = LOCK_TRY_ONCE;
+ gBufMgr->bo_lock_type = TBM_BUFMGR_BO_LOCK_TYPE_ONCE;
else
- gBufMgr->lock_type = LOCK_TRY_ALWAYS;
+ gBufMgr->bo_lock_type = TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS;
TBM_DBG("BUFMGR_LOCK_TYPE=%s\n", env ? env : "default:once");
TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(gBufMgr), 0);
TBM_BUFMGR_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
- if (bufmgr->lock_type == LOCK_TRY_NEVER) {
+ if (bufmgr->bo_lock_type == TBM_BUFMGR_BO_LOCK_TYPE_NEVER) {
TBM_LOG_E("bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
_tbm_bufmgr_mutex_unlock();
return 0;