panfrost: gen_pack: Add a no-direct-packing attribute

To signify when a struct is not meant to be packed directly but should
instead be embedded in another struct.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6980>
This commit is contained in:
Boris Brezillon 2020-09-16 09:16:04 +02:00
parent 4205c95b34
commit f2044044e6
1 changed files with 4 additions and 2 deletions

View File

@ -642,6 +642,7 @@ class Parser(object):
print(pack_header)
elif name == "struct":
name = attrs["name"]
self.no_direct_packing = attrs.get("no-direct-packing", False)
object_name = self.gen_prefix(safe_name(name.upper()))
self.struct = object_name
@ -761,8 +762,9 @@ class Parser(object):
self.emit_template_struct(self.struct, self.group)
self.emit_header(name)
self.emit_pack_function(self.struct, self.group)
self.emit_unpack_function(self.struct, self.group)
if self.no_direct_packing == False:
self.emit_pack_function(self.struct, self.group)
self.emit_unpack_function(self.struct, self.group)
self.emit_print_function(self.struct, self.group)
def enum_prefix(self, name):