atomic.patch revision 1549
106N/A--- intel/intel_bufmgr_gem.c Fri Feb 20 06:27:47 2015
106N/A+++ intel/intel_bufmgr_gem.c Fri Feb 20 07:00:16 2015
106N/A@@ -93,7 +93,7 @@
106N/A typedef struct _drm_intel_bufmgr_gem {
106N/A drm_intel_bufmgr bufmgr;
106N/A
106N/A- atomic_t refcount;
106N/A+ int refcount;
106N/A
106N/A int fd;
106N/A
106N/A@@ -147,7 +147,7 @@
106N/A struct _drm_intel_bo_gem {
106N/A drm_intel_bo bo;
106N/A
106N/A- atomic_t refcount;
106N/A+ int refcount;
106N/A uint32_t gem_handle;
106N/A const char *name;
106N/A
106N/A@@ -416,7 +416,7 @@
106N/A {
3778N/A drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
106N/A
106N/A- atomic_inc(&bo_gem->refcount);
106N/A+ bo_gem->refcount++;
106N/A }
106N/A
1247N/A /**
618N/A@@ -772,7 +772,7 @@
106N/A }
106N/A
844N/A bo_gem->name = name;
1247N/A- atomic_set(&bo_gem->refcount, 1);
1247N/A+ bo_gem->refcount = 1;
1273N/A bo_gem->validate_index = -1;
106N/A bo_gem->reloc_tree_fences = 0;
3661N/A bo_gem->used_as_reloc_target = false;
3661N/A@@ -919,7 +919,7 @@
3778N/A DRMINITLISTHEAD(&bo_gem->vma_list);
3778N/A
3778N/A bo_gem->name = name;
3996N/A- atomic_set(&bo_gem->refcount, 1);
4561N/A+ bo_gem->refcount = 1;
4561N/A bo_gem->validate_index = -1;
4561N/A bo_gem->reloc_tree_fences = 0;
4561N/A bo_gem->used_as_reloc_target = false;
4561N/A@@ -1010,7 +1010,7 @@
4561N/A bo_gem->bo.virtual = NULL;
4561N/A bo_gem->bo.bufmgr = bufmgr;
4561N/A bo_gem->name = name;
3996N/A- atomic_set(&bo_gem->refcount, 1);
3996N/A+ bo_gem->refcount = 1;
106N/A bo_gem->validate_index = -1;
1247N/A bo_gem->gem_handle = open_arg.handle;
1247N/A bo_gem->bo.handle = open_arg.handle;
1247N/A@@ -1239,8 +1239,8 @@
1874N/A {
1874N/A drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
1247N/A
1874N/A- assert(atomic_read(&bo_gem->refcount) > 0);
1874N/A- if (atomic_dec_and_test(&bo_gem->refcount))
1247N/A+ assert(bo_gem->refcount > 0);
1247N/A+ if (--bo_gem->refcount == 0)
106N/A drm_intel_gem_bo_unreference_final(bo, time);
106N/A }
1874N/A
106N/A@@ -1248,7 +1248,7 @@
1874N/A {
727N/A drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
1247N/A
1247N/A- assert(atomic_read(&bo_gem->refcount) > 0);
1247N/A+ assert(bo_gem->refcount > 0);
1247N/A
1247N/A if (atomic_add_unless(&bo_gem->refcount, -1, 1)) {
1247N/A drm_intel_bufmgr_gem *bufmgr_gem =
1247N/A@@ -1259,7 +1259,7 @@
1247N/A
1247N/A pthread_mutex_lock(&bufmgr_gem->lock);
1247N/A
1247N/A- if (atomic_dec_and_test(&bo_gem->refcount)) {
1247N/A+ if (--bo_gem->refcount == 0) {
106N/A drm_intel_gem_bo_unreference_final(bo, time.tv_sec);
106N/A drm_intel_gem_cleanup_bo_cache(bufmgr_gem, time.tv_sec);
1247N/A }
1247N/A@@ -2683,7 +2683,7 @@
1247N/A
247N/A bo_gem->gem_handle = handle;
1874N/A
106N/A- atomic_set(&bo_gem->refcount, 1);
3996N/A+ bo_gem->refcount = 1;
4237N/A
bo_gem->name = "prime";
bo_gem->validate_index = -1;
@@ -3346,7 +3346,7 @@
DRMLISTFOREACHENTRY(bufmgr_gem, &bufmgr_list, managers) {
if (bufmgr_gem->fd == fd) {
- atomic_inc(&bufmgr_gem->refcount);
+ bufmgr_gem->refcount++;
return bufmgr_gem;
}
}
@@ -3362,7 +3362,7 @@
if (atomic_add_unless(&bufmgr_gem->refcount, -1, 1)) {
pthread_mutex_lock(&bufmgr_list_mutex);
- if (atomic_dec_and_test(&bufmgr_gem->refcount)) {
+ if (--bufmgr_gem->refcount == 0) {
DRMLISTDEL(&bufmgr_gem->managers);
drm_intel_bufmgr_gem_destroy(bufmgr);
}
@@ -3443,7 +3443,7 @@
goto exit;
bufmgr_gem->fd = fd;
- atomic_set(&bufmgr_gem->refcount, 1);
+ bufmgr_gem->refcount = 1;
if (pthread_mutex_init(&bufmgr_gem->lock, NULL) != 0) {
free(bufmgr_gem);