Lines Matching refs:cache
34 add_bucket(struct fd_bo_cache *cache, int size)
36 unsigned int i = cache->num_buckets;
38 assert(i < ARRAY_SIZE(cache->cache_bucket));
40 list_inithead(&cache->cache_bucket[i].list);
41 cache->cache_bucket[i].size = size;
42 cache->num_buckets++;
50 fd_bo_cache_init(struct fd_bo_cache *cache, int coarse)
60 * get us useful cache hit rates anyway)
62 add_bucket(cache, 4096);
63 add_bucket(cache, 4096 * 2);
65 add_bucket(cache, 4096 * 3);
67 /* Initialize the linked lists for BO reuse cache. */
69 add_bucket(cache, size);
71 add_bucket(cache, size + size * 1 / 4);
72 add_bucket(cache, size + size * 2 / 4);
73 add_bucket(cache, size + size * 3 / 4);
80 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;
110 get_bucket(struct fd_bo_cache *cache, uint32_t size)
117 for (i = 0; i < cache->num_buckets; i++) {
118 struct fd_bo_bucket *bucket = &cache->cache_bucket[i];
137 * (MRU, since likely to be in GPU cache), rather than head (LRU)..
156 fd_bo_cache_alloc(struct fd_bo_cache *cache, uint32_t *size, uint32_t flags)
162 bucket = get_bucket(cache, *size);
188 fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo)
195 struct fd_bo_bucket *bucket = get_bucket(cache, bo->size);
208 fd_bo_cache_cleanup(cache, time.tv_sec);