summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-07-17 14:29:41 -0700
committerEric Anholt <[email protected]>2018-07-20 11:11:29 -0700
commitd0e53373e554831d3755d792d05055eb1a751c80 (patch)
tree580fc440869df4efd1eb6bcd3c66d6fb38ff8618
parent7d6aef6fa5b9871d46c9f2d1cf06e70fef69adfb (diff)
v3d: Move BO cache counting to dump time instead of cache management.
This is one less way to get the dump stats wrong.
-rw-r--r--src/gallium/drivers/v3d/v3d_bufmgr.c15
-rw-r--r--src/gallium/drivers/v3d/v3d_screen.h3
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;