[Mesa-dev] [PATCH 03/10] util: Make vma.c support non-power-of-two alignments.
Jordan Justen
jordan.l.justen at intel.com
Tue May 8 18:03:34 UTC 2018
Could potentially just fold into "util: Add a virtual memory
allocator".
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
On 2018-05-03 18:12:33, Kenneth Graunke wrote:
> I want to use this in a bucketing allocator for i965.
> ---
> src/util/vma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/util/vma.c b/src/util/vma.c
> index 3d61f6969ed..d6ee05988ef 100644
> --- a/src/util/vma.c
> +++ b/src/util/vma.c
> @@ -88,7 +88,6 @@ util_vma_heap_alloc(struct util_vma_heap *heap,
> assert(size > 0);
>
> assert(alignment > 0);
> - assert(util_is_power_of_two_nonzero(alignment));
>
> util_vma_heap_validate(heap);
>
> @@ -107,7 +106,7 @@ util_vma_heap_alloc(struct util_vma_heap *heap,
> /* Align the offset. We align down and not up because we are allocating
> * from the top of the hole and not the bottom.
> */
> - offset &= ~(alignment - 1);
> + offset = (offset / alignment) * alignment;
>
> if (offset < hole->offset)
> continue;
> --
> 2.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list