From d0e53373e554831d3755d792d05055eb1a751c80 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Jul 2018 14:29:41 -0700 Subject: [PATCH] v3d: Move BO cache counting to dump time instead of cache management. This is one less way to get the dump stats wrong. --- src/gallium/drivers/v3d/v3d_bufmgr.c | 15 +++++++++------ src/gallium/drivers/v3d/v3d_screen.h | 3 --- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_bufmgr.c b/src/gallium/drivers/v3d/v3d_bufmgr.c index 1b4acc6fca8..f0018ea6936 100644 --- a/src/gallium/drivers/v3d/v3d_bufmgr.c +++ b/src/gallium/drivers/v3d/v3d_bufmgr.c @@ -53,10 +53,17 @@ v3d_bo_dump_stats(struct v3d_screen *screen) { struct v3d_bo_cache *cache = &screen->bo_cache; + uint32_t cache_count = 0; + uint32_t cache_size = 0; + list_for_each_entry(struct v3d_bo, bo, &cache->time_list, time_list) { + cache_count++; + cache_size += bo->size; + } + fprintf(stderr, " BOs allocated: %d\n", screen->bo_count); fprintf(stderr, " BOs size: %dkb\n", screen->bo_size / 1024); - fprintf(stderr, " BOs cached: %d\n", cache->bo_count); - fprintf(stderr, " BOs cached size: %dkb\n", cache->bo_size / 1024); + fprintf(stderr, " BOs cached: %d\n", cache_count); + fprintf(stderr, " BOs cached size: %dkb\n", cache_size / 1024); if (!list_empty(&cache->time_list)) { struct v3d_bo *first = LIST_ENTRY(struct v3d_bo, @@ -83,8 +90,6 @@ v3d_bo_remove_from_cache(struct v3d_bo_cache *cache, struct v3d_bo *bo) { list_del(&bo->time_list); list_del(&bo->size_list); - cache->bo_count--; - cache->bo_size -= bo->size; } static struct v3d_bo * @@ -310,8 +315,6 @@ v3d_bo_last_unreference_locked_timed(struct v3d_bo *bo, time_t time) bo->free_time = time; list_addtail(&bo->size_list, &cache->size_list[page_index]); list_addtail(&bo->time_list, &cache->time_list); - cache->bo_count++; - cache->bo_size += bo->size; if (dump_stats) { fprintf(stderr, "Freed %s %dkb to cache:\n", bo->name, bo->size / 1024); diff --git a/src/gallium/drivers/v3d/v3d_screen.h b/src/gallium/drivers/v3d/v3d_screen.h index 111dd196f6c..4d30ef30bce 100644 --- a/src/gallium/drivers/v3d/v3d_screen.h +++ b/src/gallium/drivers/v3d/v3d_screen.h @@ -71,9 +71,6 @@ struct v3d_screen { uint32_t size_list_size; mtx_t lock; - - uint32_t bo_size; - uint32_t bo_count; } bo_cache; const struct v3d_compiler *compiler; -- 2.30.2