Lines Matching refs:cache

33 static void add_bucket(struct etna_bo_cache *cache, int size)
35 unsigned i = cache->num_buckets;
37 assert(i < ARRAY_SIZE(cache->cache_bucket));
39 list_inithead(&cache->cache_bucket[i].list);
40 cache->cache_bucket[i].size = size;
41 cache->num_buckets++;
44 drm_private void etna_bo_cache_init(struct etna_bo_cache *cache)
54 * get us useful cache hit rates anyway)
56 add_bucket(cache, 4096);
57 add_bucket(cache, 4096 * 2);
58 add_bucket(cache, 4096 * 3);
60 /* Initialize the linked lists for BO reuse cache. */
62 add_bucket(cache, size);
63 add_bucket(cache, size + size * 1 / 4);
64 add_bucket(cache, size + size * 2 / 4);
65 add_bucket(cache, size + size * 3 / 4);
70 drm_private void etna_bo_cache_cleanup(struct etna_bo_cache *cache, time_t time)
74 if (cache->time == time)
77 for (i = 0; i < cache->num_buckets; i++) {
78 struct etna_bo_bucket *bucket = &cache->cache_bucket[i];
84 /* keep things in cache for at least 1 second: */
93 cache->time = time;
96 static struct etna_bo_bucket *get_bucket(struct etna_bo_cache *cache, uint32_t size)
103 for (i = 0; i < cache->num_buckets; i++) {
104 struct etna_bo_bucket *bucket = &cache->cache_bucket[i];
158 drm_private struct etna_bo *etna_bo_cache_alloc(struct etna_bo_cache *cache, uint32_t *size,
165 bucket = get_bucket(cache, *size);
181 drm_private int etna_bo_cache_free(struct etna_bo_cache *cache, struct etna_bo *bo)
183 struct etna_bo_bucket *bucket = get_bucket(cache, bo->size);
193 etna_bo_cache_cleanup(cache, time.tv_sec);
195 /* bo's in the bucket cache don't have a ref and