Skip to content

Commit e9ba37d

Browse files
airlieddakr
authored andcommitted
nouveau: find the smallest page allocation to cover a buffer alloc.
With the new uapi we don't have the comp flags on the allocation, so we shouldn't be using the first size that works, we should be iterating until we get the correct one. This reduces allocations from 2MB to 64k in lots of places. Fixes dEQP-VK.memory.allocation.basic.size_8KiB.forward.count_4000 on my ampere/gsp system. Cc: [email protected] # v6.6 Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Faith Ekstrand <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent b9c02e1 commit e9ba37d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
318318
(!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT))
319319
continue;
320320

321-
if (pi < 0)
322-
pi = i;
321+
/* pick the last one as it will be smallest. */
322+
pi = i;
323+
323324
/* Stop once the buffer is larger than the current page size. */
324325
if (*size >= 1ULL << vmm->page[i].shift)
325326
break;

0 commit comments

Comments
 (0)