diff --git a/src/panfrost/lib/genxml/gen_pack.py b/src/panfrost/lib/genxml/gen_pack.py index fa637487b14..0ae386a38d9 100644 --- a/src/panfrost/lib/genxml/gen_pack.py +++ b/src/panfrost/lib/genxml/gen_pack.py @@ -636,13 +636,8 @@ class Parser(object): print('#define {}_SECTION_{}_OFFSET {}'.format(aggregate.name.upper(), section.name.upper(), section.offset)) print("") - def emit_pack_function(self, name, group): - print("static ALWAYS_INLINE void\n%s_pack(uint32_t * restrict cl,\n%sconst struct %s * restrict values)\n{" % - (name, ' ' * (len(name) + 6), name)) - - group.emit_pack_function() - - print("}\n\n") + def emit_struct_detail(self, name, group): + group.get_length() # Should be a whole number of words assert((self.group.length % 4) == 0) @@ -652,6 +647,14 @@ class Parser(object): print('#define {} {}'.format (name + "_ALIGN", self.group.align)) print('struct {}_packed {{ uint32_t opaque[{}]; }};'.format(name.lower(), self.group.length // 4)) + def emit_pack_function(self, name, group): + print("static ALWAYS_INLINE void\n%s_pack(uint32_t * restrict cl,\n%sconst struct %s * restrict values)\n{" % + (name, ' ' * (len(name) + 6), name)) + + group.emit_pack_function() + + print("}\n\n") + def emit_unpack_function(self, name, group): print("static inline void") print("%s_unpack(const uint32_t * restrict cl,\n%sstruct %s * restrict values)\n{" % @@ -675,6 +678,7 @@ class Parser(object): self.emit_template_struct(self.struct, self.group) self.emit_header(name) if self.no_direct_packing == False: + self.emit_struct_detail(self.struct, self.group) self.emit_pack_function(self.struct, self.group) self.emit_unpack_function(self.struct, self.group) self.emit_print_function(self.struct, self.group)