nouveau: find the smallest page allocation to cover a buffer alloc.
authorDave Airlie <airlied@redhat.com>
Fri, 11 Aug 2023 03:15:20 +0000 (13:15 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Dec 2023 07:52:18 +0000 (08:52 +0100)
commit59ae50ebf09e55672d7fae31ee7ed414916116ec
tree4b679309c554afd7a14a2245794c3c895b2e234b
parent09f7520048eaaee9709091cd2787966f807da7c5
nouveau: find the smallest page allocation to cover a buffer alloc.

commit e9ba37d9f9a6872b069dd893bd86a7d77ba8c153 upstream.

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: stable@vger.kernel.org # v6.6
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230811031520.248341-1-airlied@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/nouveau/nouveau_bo.c