Mesa (main): panfrost: Add a concatenation macro for genxml
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jul 23 20:28:03 UTC 2021
Module: Mesa
Branch: main
Commit: d7a0720ef16aecb6595816363f5467a775716c12
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7a0720ef16aecb6595816363f5467a775716c12
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Tue Jul 13 12:02:20 2021 -0400
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 at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11851>
---
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) \\
More information about the mesa-commit
mailing list