#ifdef DEBUG
static struct llvmpipe_resource resource_list;
+static mtx_t resource_list_mutex = _MTX_INITIALIZER_NP;
#endif
static unsigned id_counter = 0;
lpr->id = id_counter++;
#ifdef DEBUG
+ mtx_lock(&resource_list_mutex);
insert_at_tail(&resource_list, lpr);
+ mtx_unlock(&resource_list_mutex);
#endif
return &lpr->base;
}
}
#ifdef DEBUG
+ mtx_lock(&resource_list_mutex);
if (lpr->next)
remove_from_list(lpr);
+ mtx_unlock(&resource_list_mutex);
#endif
FREE(lpr);
lpr->id = id_counter++;
#ifdef DEBUG
+ mtx_lock(&resource_list_mutex);
insert_at_tail(&resource_list, lpr);
+ mtx_unlock(&resource_list_mutex);
#endif
return &lpr->base;
unsigned n = 0, total = 0;
debug_printf("LLVMPIPE: current resources:\n");
+ mtx_lock(&resource_list_mutex);
foreach(lpr, &resource_list) {
unsigned size = llvmpipe_resource_size(&lpr->base);
debug_printf("resource %u at %p, size %ux%ux%u: %u bytes, refcount %u\n",
total += size;
n++;
}
+ mtx_unlock(&resource_list_mutex);
debug_printf("LLVMPIPE: total size of %u resources: %u\n", n, total);
}
#endif