[igt-dev] [PATCH i-g-t v4 11/15] lib/intel_allocator: treat default_alignment as the minimum

Niranjana Vishwanathapura niranjana.vishwanathapura at intel.com
Thu Oct 19 17:34:10 UTC 2023


On Thu, Oct 19, 2023 at 03:41:02PM +0100, Matthew Auld wrote:
>If something overrides the default alignment, we should only apply the
>alignment if it is larger than the default_alignment.
>
>Signed-off-by: Matthew Auld <matthew.auld at intel.com>
>Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
>Cc: José Roberto de Souza <jose.souza at intel.com>
>Cc: Pallavi Mishra <pallavi.mishra at intel.com>
>---
> lib/intel_allocator.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
>index e5b9457b8..d94043016 100644
>--- a/lib/intel_allocator.c
>+++ b/lib/intel_allocator.c
>@@ -586,6 +586,9 @@ static int handle_request(struct alloc_req *req, struct alloc_resp *resp)
> 		case REQ_ALLOC:
> 			if (!req->alloc.alignment)
> 				req->alloc.alignment = ial->default_alignment;
>+			else
>+				req->alloc.alignment = max(ial->default_alignment,
>+							   req->alloc.alignment);

Looks like we don't need if/else clause here.
req->alloc.alignment = max(ial->default_alignment, req->alloc.alignment);

Other than that, change looks good to me.
Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>

Niranjana

>
> 			resp->response_type = RESP_ALLOC;
> 			resp->alloc.offset = ial->alloc(ial,
>-- 
>2.41.0
>


More information about the igt-dev mailing list