diff options
author | Marek Olšák <[email protected]> | 2016-07-17 00:53:55 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-07-19 23:45:06 +0200 |
commit | 3cdc0e133f77b5095525d23a30827b40954be1c7 (patch) | |
tree | 49275e3869a2430f1ff4ce5d0605140796534cc9 /src/gallium/auxiliary/pipebuffer/pb_cache.h | |
parent | fec7f74129622f846c79edc3a6b050db62c89554 (diff) |
gallium/pb_cache: divide the cache into buckets for reducing cache misses
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer/pb_cache.h')
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_cache.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.h b/src/gallium/auxiliary/pipebuffer/pb_cache.h index f0fa0122602..aa83cc8b38c 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_cache.h +++ b/src/gallium/auxiliary/pipebuffer/pb_cache.h @@ -42,11 +42,16 @@ struct pb_cache_entry struct pb_buffer *buffer; /**< Pointer to the structure this is part of. */ struct pb_cache *mgr; int64_t start, end; /**< Caching time interval */ + unsigned bucket_index; }; struct pb_cache { - struct list_head cache; + /* The cache is divided into buckets for minimizing cache misses. + * The driver controls which buffer goes into which bucket. + */ + struct list_head buckets[8]; + pipe_mutex mutex; uint64_t cache_size; uint64_t max_cache_size; @@ -61,10 +66,11 @@ struct pb_cache void pb_cache_add_buffer(struct pb_cache_entry *entry); struct pb_buffer *pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size size, - unsigned alignment, unsigned usage); + unsigned alignment, unsigned usage, + unsigned bucket_index); void pb_cache_release_all_buffers(struct pb_cache *mgr); void pb_cache_init_entry(struct pb_cache *mgr, struct pb_cache_entry *entry, - struct pb_buffer *buf); + struct pb_buffer *buf, unsigned bucket_index); void pb_cache_init(struct pb_cache *mgr, uint usecs, float size_factor, unsigned bypass_usage, uint64_t maximum_cache_size, void (*destroy_buffer)(struct pb_buffer *buf), |