freedreno: support either coarse or fine-grained bucket sizes
The normal bo cache uses some intermediate steps between power of two jumps to reduce memory wastage. But for a ringbuffer bo cache, we do not need this. Signed-off-by: Rob Clark <robclark@freedesktop.org>main
parent
904f1361ae
commit
8a6a8512d4
|
@ -49,8 +49,12 @@ add_bucket(struct fd_bo_cache *cache, int size)
|
||||||
cache->num_buckets++;
|
cache->num_buckets++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @coarse: if true, only power-of-two bucket sizes, otherwise
|
||||||
|
* fill in for a bit smoother size curve..
|
||||||
|
*/
|
||||||
drm_private void
|
drm_private void
|
||||||
fd_bo_cache_init(struct fd_bo_cache *cache)
|
fd_bo_cache_init(struct fd_bo_cache *cache, int course)
|
||||||
{
|
{
|
||||||
unsigned long size, cache_max_size = 64 * 1024 * 1024;
|
unsigned long size, cache_max_size = 64 * 1024 * 1024;
|
||||||
|
|
||||||
|
@ -64,14 +68,17 @@ fd_bo_cache_init(struct fd_bo_cache *cache)
|
||||||
*/
|
*/
|
||||||
add_bucket(cache, 4096);
|
add_bucket(cache, 4096);
|
||||||
add_bucket(cache, 4096 * 2);
|
add_bucket(cache, 4096 * 2);
|
||||||
add_bucket(cache, 4096 * 3);
|
if (!course)
|
||||||
|
add_bucket(cache, 4096 * 3);
|
||||||
|
|
||||||
/* Initialize the linked lists for BO reuse cache. */
|
/* Initialize the linked lists for BO reuse cache. */
|
||||||
for (size = 4 * 4096; size <= cache_max_size; size *= 2) {
|
for (size = 4 * 4096; size <= cache_max_size; size *= 2) {
|
||||||
add_bucket(cache, size);
|
add_bucket(cache, size);
|
||||||
add_bucket(cache, size + size * 1 / 4);
|
if (!course) {
|
||||||
add_bucket(cache, size + size * 2 / 4);
|
add_bucket(cache, size + size * 1 / 4);
|
||||||
add_bucket(cache, size + size * 3 / 4);
|
add_bucket(cache, size + size * 2 / 4);
|
||||||
|
add_bucket(cache, size + size * 3 / 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ out:
|
||||||
dev->fd = fd;
|
dev->fd = fd;
|
||||||
dev->handle_table = drmHashCreate();
|
dev->handle_table = drmHashCreate();
|
||||||
dev->name_table = drmHashCreate();
|
dev->name_table = drmHashCreate();
|
||||||
fd_bo_cache_init(&dev->bo_cache);
|
fd_bo_cache_init(&dev->bo_cache, FALSE);
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct fd_device {
|
||||||
int closefd; /* call close(fd) upon destruction */
|
int closefd; /* call close(fd) upon destruction */
|
||||||
};
|
};
|
||||||
|
|
||||||
drm_private void fd_bo_cache_init(struct fd_bo_cache *cache);
|
drm_private void fd_bo_cache_init(struct fd_bo_cache *cache, int coarse);
|
||||||
drm_private void fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time);
|
drm_private void fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time);
|
||||||
drm_private struct fd_bo * fd_bo_cache_alloc(struct fd_bo_cache *cache,
|
drm_private struct fd_bo * fd_bo_cache_alloc(struct fd_bo_cache *cache,
|
||||||
uint32_t *size, uint32_t flags);
|
uint32_t *size, uint32_t flags);
|
||||||
|
|
Loading…
Reference in New Issue