From: Kristian Høgsberg Kristensen Date: Thu, 11 Feb 2016 00:35:28 +0000 (-0800) Subject: anv: Handle dwords that are all MBZ correctly X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d2623a324713134b4da6e08775aed868300e96cb;p=mesa.git anv: Handle dwords that are all MBZ correctly A few packets have dwords in them that are all MBZ and we failed to write those. This change makes sure we iterate through all dwords and write them all. --- diff --git a/src/vulkan/gen_pack_header.py b/src/vulkan/gen_pack_header.py index 58da0184faf..8ed74581063 100755 --- a/src/vulkan/gen_pack_header.py +++ b/src/vulkan/gen_pack_header.py @@ -329,11 +329,27 @@ class Group: dwords = {} self.collect_dwords(dwords, 0, "") - for index, dw in dwords.items(): + # Determine number of dwords in this group. If we have a size, use + # that, since that'll account for MBZ dwords at the end of a group + # (like dword 8 on BDW+ 3DSTATE_HS). Otherwise, use the largest dword + # index we've seen plus one. + if self.size > 0: + length = self.size // 32 + else: + length = max(dwords.keys()) + 1 + + for index in range(length): + # Handle MBZ dwords + if not index in dwords: + print("") + print(" dw[%d] = 0;" % index) + continue + # For 64 bit dwords, we aliased the two dword entries in the dword # dict it occupies. Now that we're emitting the pack function, # skip the duplicate entries. - if index > 0 and index - 1 in dwords and dwords[index - 1] == dwords[index]: + dw = dwords[index] + if index > 0 and index - 1 in dwords and dw == dwords[index - 1]: continue # Special case: only one field and it's a struct at the beginning @@ -453,21 +469,26 @@ class Parser: self.gen = attrs["gen"].replace('.', '') print(pack_header % {'license': license, 'platform': self.platform}) elif name == "instruction": - self.group = Group(self, None, 0, 1, 0) self.instruction = safe_name(attrs["name"]) self.length_bias = int(attrs["bias"]) if "length" in attrs: self.length = int(attrs["length"]) + size = self.length * 32 else: self.length = None + size = 0 + self.group = Group(self, None, 0, 1, size) elif name == "struct": - self.group = Group(self, None, 0, 1, 0) self.struct = safe_name(attrs["name"]) self.structs[attrs["name"]] = 1 if "length" in attrs: self.length = int(attrs["length"]) + size = self.length * 32 else: self.length = None + size = 0 + self.group = Group(self, None, 0, 1, size) + elif name == "group": group = Group(self, self.group, int(attrs["start"]), int(attrs["count"]), int(attrs["size"]))