Lines Matching defs:cache
36 add_bucket(struct fd_bo_cache *cache, int size)
38 unsigned int i = cache->num_buckets;
40 assert(i < ARRAY_SIZE(cache->cache_bucket));
42 list_inithead(&cache->cache_bucket[i].list);
43 cache->cache_bucket[i].size = size;
44 cache->num_buckets++;
52 fd_bo_cache_init(struct fd_bo_cache *cache, int coarse)
62 * get us useful cache hit rates anyway)
64 add_bucket(cache, 4096);
65 add_bucket(cache, 4096 * 2);
67 add_bucket(cache, 4096 * 3);
69 /* Initialize the linked lists for BO reuse cache. */
71 add_bucket(cache, size);
73 add_bucket(cache, size + size * 1 / 4);
74 add_bucket(cache, size + size * 2 / 4);
75 add_bucket(cache, size + size * 3 / 4);
82 fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time)
86 if (cache->time == time)
89 for (i = 0; i < cache->num_buckets; i++) {
90 struct fd_bo_bucket *bucket = &cache->cache_bucket[i];
96 /* keep things in cache for at least 1 second: */
106 cache->time = time;
109 static struct fd_bo_bucket * get_bucket(struct fd_bo_cache *cache, uint32_t size)
116 for (i = 0; i < cache->num_buckets; i++) {
117 struct fd_bo_bucket *bucket = &cache->cache_bucket[i];
143 * (MRU, since likely to be in GPU cache), rather than head (LRU)..
162 fd_bo_cache_alloc(struct fd_bo_cache *cache, uint32_t *size, uint32_t flags)
168 bucket = get_bucket(cache, *size);
194 fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo)
196 struct fd_bo_bucket *bucket = get_bucket(cache, bo->size);
209 fd_bo_cache_cleanup(cache, time.tv_sec);
211 /* bo's in the bucket cache don't have a ref and