summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-05-26 16:21:55 -0700
committerKenneth Graunke <[email protected]>2019-05-29 19:42:15 -0700
commit4c2d9729dfc6c3577b823a92e2bbbf425ffee143 (patch)
tree1f2d3e1981631599ed8f39729eb0e75690da0add /src/gallium/drivers
parent7acc88a47cbe3c420e04f281adc0fc1728c4a438 (diff)
iris: Tidy BO sizing code and comments
Buckets haven't been power of two sized in over a decade. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/iris/iris_bufmgr.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index 43ac0a144f5..60645fbb2cc 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -460,21 +460,14 @@ bo_alloc_internal(struct iris_bufmgr *bufmgr,
{
struct iris_bo *bo;
unsigned int page_size = getpagesize();
- struct bo_cache_bucket *bucket;
- uint64_t bo_size;
bool alloc_pages = false;
+ struct bo_cache_bucket *bucket = bucket_for_size(bufmgr, size);
- /* Round the allocated size up to a power of two number of pages. */
- bucket = bucket_for_size(bufmgr, size);
-
- /* If we don't have caching at this size, don't actually round the
- * allocation up.
+ /* Round the size up to the bucket size, or if we don't have caching
+ * at this size, a multiple of the page size.
*/
- if (bucket == NULL) {
- bo_size = MAX2(ALIGN(size, page_size), page_size);
- } else {
- bo_size = bucket->size;
- }
+ uint64_t bo_size =
+ bucket ? bucket->size : MAX2(ALIGN(size, page_size), page_size);
mtx_lock(&bufmgr->lock);