* [Nouveau] [PATCH] nouveau: find the smallest page allocation to cover a buffer alloc.
@ 2023-08-11 3:15 ` Dave Airlie
0 siblings, 0 replies; 4+ messages in thread
From: Dave Airlie @ 2023-08-11 3:15 UTC (permalink / raw)
To: dri-devel; +Cc: nouveau
From: Dave Airlie <airlied@redhat.com>
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.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_bo.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 949195d5d782..a6993c7807b6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -318,8 +318,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
(!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT))
continue;
- if (pi < 0)
- pi = i;
+ /* pick the last one as it will be smallest. */
+ pi = i;
+
/* Stop once the buffer is larger than the current page size. */
if (*size >= 1ULL << vmm->page[i].shift)
break;
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] nouveau: find the smallest page allocation to cover a buffer alloc.
@ 2023-08-11 3:15 ` Dave Airlie
0 siblings, 0 replies; 4+ messages in thread
From: Dave Airlie @ 2023-08-11 3:15 UTC (permalink / raw)
To: dri-devel; +Cc: nouveau
From: Dave Airlie <airlied@redhat.com>
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.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_bo.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 949195d5d782..a6993c7807b6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -318,8 +318,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
(!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT))
continue;
- if (pi < 0)
- pi = i;
+ /* pick the last one as it will be smallest. */
+ pi = i;
+
/* Stop once the buffer is larger than the current page size. */
if (*size >= 1ULL << vmm->page[i].shift)
break;
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Nouveau] [PATCH] nouveau: find the smallest page allocation to cover a buffer alloc.
2023-08-11 3:15 ` Dave Airlie
@ 2023-08-12 14:53 ` Faith Ekstrand
-1 siblings, 0 replies; 4+ messages in thread
From: Faith Ekstrand @ 2023-08-12 14:53 UTC (permalink / raw)
To: Dave Airlie; +Cc: nouveau, dri-devel
[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]
On Thu, Aug 10, 2023 at 10:15 PM Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> 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.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_bo.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c
> b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 949195d5d782..a6993c7807b6 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -318,8 +318,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size,
> int *align, u32 domain,
> (!vmm->page[i].host || vmm->page[i].shift >
> PAGE_SHIFT))
> continue;
>
> - if (pi < 0)
> - pi = i;
> + /* pick the last one as it will be smallest. */
> + pi = i;
> +
> /* Stop once the buffer is larger than the current
> page size. */
> if (*size >= 1ULL << vmm->page[i].shift)
> break;
> --
> 2.41.0
>
>
[-- Attachment #2: Type: text/html, Size: 2439 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nouveau: find the smallest page allocation to cover a buffer alloc.
@ 2023-08-12 14:53 ` Faith Ekstrand
0 siblings, 0 replies; 4+ messages in thread
From: Faith Ekstrand @ 2023-08-12 14:53 UTC (permalink / raw)
To: Dave Airlie; +Cc: nouveau, dri-devel
[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]
On Thu, Aug 10, 2023 at 10:15 PM Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> 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.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_bo.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c
> b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 949195d5d782..a6993c7807b6 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -318,8 +318,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size,
> int *align, u32 domain,
> (!vmm->page[i].host || vmm->page[i].shift >
> PAGE_SHIFT))
> continue;
>
> - if (pi < 0)
> - pi = i;
> + /* pick the last one as it will be smallest. */
> + pi = i;
> +
> /* Stop once the buffer is larger than the current
> page size. */
> if (*size >= 1ULL << vmm->page[i].shift)
> break;
> --
> 2.41.0
>
>
[-- Attachment #2: Type: text/html, Size: 2439 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-12 14:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 3:15 [Nouveau] [PATCH] nouveau: find the smallest page allocation to cover a buffer alloc Dave Airlie
2023-08-11 3:15 ` Dave Airlie
2023-08-12 14:53 ` [Nouveau] " Faith Ekstrand
2023-08-12 14:53 ` Faith Ekstrand
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.