From d7a0720ef16aecb6595816363f5467a775716c12 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 13 Jul 2021 12:02:20 -0400 Subject: [PATCH] panfrost: Add a concatenation macro for genxml This is safer, since it allows the thing being concatenated to itself be an expande macro, which we'll use as a stopgap to construct tiler jobs with unified code. It's also a bit more readable, I think. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/lib/gen_pack.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py index 72cc644b87f..f6a20fdcf74 100644 --- a/src/panfrost/lib/gen_pack.py +++ b/src/panfrost/lib/gen_pack.py @@ -149,17 +149,19 @@ __gen_unpack_padded(const uint8_t *restrict cl, uint32_t start, uint32_t end) #define pan_print(fp, T, var, indent) \\ MALI_ ## T ## _print(fp, &(var), indent) +#define PREFIX(A, B, C, D) MALI_ ## A ## _ ## B ## _ ## C ## _ ## D + #define pan_section_offset(A, S) \\ - MALI_ ## A ## _SECTION_ ## S ## _OFFSET + PREFIX(A, SECTION, S, OFFSET) #define pan_section_ptr(base, A, S) \\ ((void *)((uint8_t *)(base) + pan_section_offset(A, S))) #define pan_section_pack(dst, A, S, name) \\ - for (MALI_ ## A ## _SECTION_ ## S ## _TYPE name = { MALI_ ## A ## _SECTION_ ## S ## _header }, \\ + for (PREFIX(A, SECTION, S, TYPE) name = { PREFIX(A, SECTION, S, header) }, \\ *_loop_terminate = (void *) (dst); \\ __builtin_expect(_loop_terminate != NULL, 1); \\ - ({ MALI_ ## A ## _SECTION_ ## S ## _pack(pan_section_ptr(dst, A, S), &name); \\ + ({ PREFIX(A, SECTION, S, pack) (pan_section_ptr(dst, A, S), &name); \\ _loop_terminate = NULL; })) #define pan_section_unpack(src, A, S, name) \\