From a031699a6b2dd2e729714698a91c9baf86d54446 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 3 Jan 2019 16:18:28 +0900 Subject: [PATCH] tbm_surface: use lock of global bufmgr lock intead lock of bufmgr Change-Id: I716abf065c650fa400062947369443b6e093eb15 --- src/tbm_bufmgr_int.h | 1 - src/tbm_surface_internal.c | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index d892426..cc789db 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -185,7 +185,6 @@ struct _tbm_bo { * */ struct _tbm_bufmgr { - pthread_mutex_t lock; /* mutex lock */ int ref_count; /* reference count */ int fd; /* bufmgr fd */ tbm_bufmgr_bo_lock_type bo_lock_type; /* lock_type of bufmgr */ diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c index 2fc3d8c..cf98f86 100644 --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -837,7 +837,7 @@ tbm_surface_internal_create_with_flags(int width, int height, bo->bufmgr = surf->bufmgr; - pthread_mutex_lock(&surf->bufmgr->lock); + _tbm_bufmgr_mutex_lock(); bo_data = bufmgr->bufmgr_func->bufmgr_alloc_bo_with_format(bufmgr->bufmgr_data, format, i, width, height, flags, &error); @@ -845,7 +845,7 @@ tbm_surface_internal_create_with_flags(int width, int height, TBM_ERR("fail to alloc bo priv. error(%d)\n", error); _tbm_set_last_result(error); free(bo); - pthread_mutex_unlock(&surf->bufmgr->lock); + _tbm_bufmgr_mutex_unlock(); goto alloc_bo_fail; } bo->bo_data = bo_data; @@ -856,7 +856,7 @@ tbm_surface_internal_create_with_flags(int width, int height, LIST_ADD(&bo->item_link, &surf->bufmgr->bo_list); - pthread_mutex_unlock(&surf->bufmgr->lock); + _tbm_bufmgr_mutex_unlock(); surf->bos[i] = bo; /* LCOV_EXCL_STOP */ @@ -879,14 +879,14 @@ tbm_surface_internal_create_with_flags(int width, int height, bo->bufmgr = surf->bufmgr; - pthread_mutex_lock(&surf->bufmgr->lock); + _tbm_bufmgr_mutex_lock(); bo_priv = bufmgr->backend->surface_bo_alloc(bo, width, height, format, flags, i); if (!bo_priv) { TBM_ERR("fail to alloc bo priv\n"); _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION); free(bo); - pthread_mutex_unlock(&surf->bufmgr->lock); + _tbm_bufmgr_mutex_unlock(); goto alloc_bo_fail; } bo->priv = bo_priv; @@ -897,7 +897,7 @@ tbm_surface_internal_create_with_flags(int width, int height, LIST_ADD(&bo->item_link, &surf->bufmgr->bo_list); - pthread_mutex_unlock(&surf->bufmgr->lock); + _tbm_bufmgr_mutex_unlock(); surf->bos[i] = bo; /* LCOV_EXCL_STOP */ -- 2.7.4