From 175549e0e988d10f8277c30ae4e6b6d5fea702a4 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 1 Jan 2018 22:47:36 +0100 Subject: pb_cache: let drivers choose the number of buckets Reviewed-by: Samuel Pitoiset --- src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 1 - src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 3 ++- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 1 - src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 4b12735bac0..92c314ecf0a 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -1226,7 +1226,6 @@ no_slab: usage = 1 << heap; /* Only set one usage bit for each heap. */ pb_cache_bucket = radeon_get_pb_cache_bucket_index(heap); - assert(pb_cache_bucket < ARRAY_SIZE(ws->bo_cache.buckets)); /* Get a buffer from the cache. */ bo = (struct amdgpu_winsys_bo*) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index ab91faf7cbc..707ebf92730 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -285,7 +285,8 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, goto fail_alloc; /* Create managers. */ - pb_cache_init(&ws->bo_cache, 500000, ws->check_vm ? 1.0f : 2.0f, 0, + pb_cache_init(&ws->bo_cache, 4, + 500000, ws->check_vm ? 1.0f : 2.0f, 0, (ws->info.vram_size + ws->info.gart_size) / 8, amdgpu_bo_destroy, amdgpu_bo_can_reclaim); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index fc95a98620b..4be6f4002ff 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -985,7 +985,6 @@ no_slab: usage = 1 << heap; /* Only set one usage bit for each heap. */ pb_cache_bucket = radeon_get_pb_cache_bucket_index(heap); - assert(pb_cache_bucket < ARRAY_SIZE(ws->bo_cache.buckets)); bo = radeon_bo(pb_cache_reclaim_buffer(&ws->bo_cache, size, alignment, usage, pb_cache_bucket)); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 10f2ecc900f..dee4366ac50 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -763,7 +763,8 @@ radeon_drm_winsys_create(int fd, const struct pipe_screen_config *config, if (!do_winsys_init(ws)) goto fail1; - pb_cache_init(&ws->bo_cache, 500000, ws->check_vm ? 1.0f : 2.0f, 0, + pb_cache_init(&ws->bo_cache, 4, + 500000, ws->check_vm ? 1.0f : 2.0f, 0, MIN2(ws->info.vram_size, ws->info.gart_size), radeon_bo_destroy, radeon_bo_can_reclaim); -- cgit v1.2.3