tbm_surface: use lock of global bufmgr lock intead lock of bufmgr 26/196726/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 3 Jan 2019 07:18:28 +0000 (16:18 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Fri, 4 Jan 2019 03:38:16 +0000 (12:38 +0900)
Change-Id: I716abf065c650fa400062947369443b6e093eb15

src/tbm_bufmgr_int.h
src/tbm_surface_internal.c

index d892426..cc789db 100644 (file)
@@ -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 */
index 2fc3d8c..cf98f86 100644 (file)
@@ -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 */