From f2044044e646f506ed29671d047bdcb0e81a9cb7 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 16 Sep 2020 09:16:04 +0200 Subject: [PATCH] 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 Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/lib/gen_pack.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py index 2c66b98fe47..c70b8b3a6e9 100644 --- a/src/panfrost/lib/gen_pack.py +++ b/src/panfrost/lib/gen_pack.py @@ -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):