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 <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11851>
This commit is contained in:
Alyssa Rosenzweig 2021-07-13 12:02:20 -04:00 committed by Marge Bot
parent f4b0d17395
commit d7a0720ef1

View file

@ -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) \\