#include "v3d_context.h"
#include "v3d_screen.h"
-#ifdef HAVE_VALGRIND
-#include <valgrind.h>
-#include <memcheck.h>
-#define VG(x) x
-#else
-#define VG(x)
-#endif
-
static bool dump_stats = false;
static void
fprintf(stderr, " BOs cached: %d\n", cache_count);
fprintf(stderr, " BOs cached size: %dkb\n", cache_size / 1024);
- if (!list_empty(&cache->time_list)) {
+ if (!list_is_empty(&cache->time_list)) {
struct v3d_bo *first = list_first_entry(&cache->time_list,
struct v3d_bo,
time_list);
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
fprintf(stderr, " now: %ld\n",
- time.tv_sec);
+ (long)time.tv_sec);
}
}
struct v3d_bo *bo = NULL;
mtx_lock(&cache->lock);
- if (!list_empty(&cache->size_list[page_index])) {
+ if (!list_is_empty(&cache->size_list[page_index])) {
bo = list_first_entry(&cache->size_list[page_index],
struct v3d_bo, size_list);
bo->offset = create.offset;
if (ret != 0) {
- if (!list_empty(&screen->bo_cache.time_list) &&
+ if (!list_is_empty(&screen->bo_cache.time_list) &&
!cleared_and_retried) {
cleared_and_retried = true;
v3d_bo_cache_free_all(&screen->bo_cache);
*/
for (int i = 0; i < cache->size_list_size; i++) {
struct list_head *old_head = &cache->size_list[i];
- if (list_empty(old_head))
+ if (list_is_empty(old_head))
list_inithead(&new_list[i]);
else {
new_list[i].next = old_head->next;
strerror(errno));
free(bo->map);
free(bo);
- return NULL;
+ bo = NULL;
+ goto done;
}
bo->offset = get.offset;
assert(bo->offset != 0);
- util_hash_table_set(screen->bo_handles, (void *)(uintptr_t)handle, bo);
+ _mesa_hash_table_insert(screen->bo_handles, (void *)(uintptr_t)handle, bo);
+
+ screen->bo_count++;
+ screen->bo_size += bo->size;
done:
mtx_unlock(&screen->bo_handles_mutex);
mtx_lock(&bo->screen->bo_handles_mutex);
bo->private = false;
- util_hash_table_set(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
+ _mesa_hash_table_insert(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
mtx_unlock(&bo->screen->bo_handles_mutex);
return fd;