[Mesa-dev] [PATCH] intel: genxml: index fields using their safe name

Lionel Landwerlin lionel.g.landwerlin at intel.com
Fri Sep 1 09:38:20 UTC 2017


With a slightly different capitalization of an additional space, 2
fields having the same safe name might not be grouped together. This
leads to multiple *_bits() functions with the same name. We can
prevent this by indexing fields with their safe name.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/genxml/gen_bits_header.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py
index 1b3504073b0..471cdace2a9 100644
--- a/src/intel/genxml/gen_bits_header.py
+++ b/src/intel/genxml/gen_bits_header.py
@@ -204,12 +204,13 @@ class Container(object):
             self.length_by_gen[gen] = xml_attrs['length']
 
     def get_field(self, field_name, create=False):
-        if field_name not in self.fields:
+        safe_field_name = safe_name(field_name)
+        if safe_field_name not in self.fields:
             if create:
-                self.fields[field_name] = Field(self, field_name)
+                self.fields[safe_field_name] = Field(self, field_name)
             else:
                 return None
-        return self.fields[field_name]
+        return self.fields[safe_field_name]
 
     def has_prop(self, prop):
         if prop == 'length':
-- 
2.14.1



More information about the mesa-dev mailing list