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

Matthew Auld matthew.auld at intel.com
Thu Nov 2 17:46:56 UTC 2023


If something overrides the default alignment, we should only apply the
alignment if it is larger than the default_alignment.

v2 (Niranjana):
  - Simplify slightly

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>
Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 lib/intel_allocator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
index e5b9457b8..96ffe40d5 100644
--- a/lib/intel_allocator.c
+++ b/lib/intel_allocator.c
@@ -584,8 +584,8 @@ static int handle_request(struct alloc_req *req, struct alloc_resp *resp)
 			break;
 
 		case REQ_ALLOC:
-			if (!req->alloc.alignment)
-				req->alloc.alignment = ial->default_alignment;
+			req->alloc.alignment = max(ial->default_alignment,
+						   req->alloc.alignment);
 
 			resp->response_type = RESP_ALLOC;
 			resp->alloc.offset = ial->alloc(ial,
-- 
2.41.0



More information about the igt-dev mailing list