Added fence counter to fence manager
authorJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 8 Apr 2008 09:48:44 +0000 (11:48 +0200)
committerJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 8 Apr 2008 09:48:44 +0000 (11:48 +0200)
src/gallium/winsys/dri/intel/ws_dri_fencemgr.c

index 8aaef1c62001e2b89d133fdbd6787e37e9e7c267..1f893b47ced42f9bc7da0e273c45ba05b7f54a4d 100644 (file)
@@ -23,6 +23,7 @@ struct _DriFenceMgr {
     _glthread_Mutex mutex;
     int refCount;
     drmMMListHead *heads;
+    int num_fences;
 };
 
 struct _DriFenceObject {
@@ -68,6 +69,7 @@ driFenceMgrCreate(const struct _DriFenceMgrCreateInfo *info)
   _glthread_LOCK_MUTEX(tmp->mutex);
   tmp->refCount = 1;
   tmp->info = *info;
+  tmp->num_fences = 0;
   tmp->heads = calloc(tmp->info.num_classes, sizeof(*tmp->heads));
   if (!tmp->heads)
       goto out_err;
@@ -114,9 +116,11 @@ driFenceUnReferenceLocked(struct _DriFenceObject **pFence)
        DRMLISTDELINIT(&fence->head);
        if (fence->private)
            mgr->info.unreference(mgr, &fence->private);
+    --mgr->num_fences;
        fence->mgr = NULL;
        --mgr->refCount;
        free(fence);
+
     }
 }
 
@@ -297,6 +301,7 @@ struct _DriFenceObject
     DRMLISTADDTAIL(&fence->head, &mgr->heads[fence_class]);
     fence->mgr = mgr;
     ++mgr->refCount;
+    ++mgr->num_fences;
     _glthread_UNLOCK_MUTEX(mgr->mutex);
     fence->fence_class = fence_class;
     fence->fence_type = fence_type;