pan/genxml: Switch pan_section_ptr to cast to packed type

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32962>
This commit is contained in:
Mary Guillemard 2025-01-08 19:02:08 +01:00 committed by Marge Bot
parent 3b69edf825
commit e15940008f
2 changed files with 3 additions and 1 deletions

View file

@ -630,6 +630,7 @@ class Parser(object):
print('#define {}_ALIGN {}'.format(aggregate.name.upper(), aggregate.align))
for section in aggregate.sections:
print('#define {}_SECTION_{}_TYPE struct {}'.format(aggregate.name.upper(), section.name.upper(), section.type_name))
print('#define {}_SECTION_{}_PACKED_TYPE {}_PACKED_T'.format(aggregate.name.upper(), section.name.upper(), section.type_name.upper()))
print('#define {}_SECTION_{}_header {}_header'.format(aggregate.name.upper(), section.name.upper(), section.type_name))
print('#define {}_SECTION_{}_pack {}_pack'.format(aggregate.name.upper(), section.name.upper(), section.type_name))
print('#define {}_SECTION_{}_unpack {}_unpack'.format(aggregate.name.upper(), section.name.upper(), section.type_name))

View file

@ -119,7 +119,8 @@ __gen_unpack_padded(const uint32_t *restrict cl, uint32_t start, uint32_t end)
#define pan_section_offset(A, S) PREFIX4(A, SECTION, S, OFFSET)
#define pan_section_ptr(base, A, S) \
((void *)((uint8_t *)(base) + pan_section_offset(A, S)))
((PREFIX4(A, SECTION, S, PACKED_TYPE) *)((uint8_t *)(base) + \
pan_section_offset(A, S)))
#define pan_section_pack(dst, A, S, name) \
for (PREFIX4(A, SECTION, S, TYPE) name = {PREFIX4(A, SECTION, S, header)}, \