[Mesa-dev] [PATCH 3/8] intel/genxml/bits: Emit per-field _start helpers

Jason Ekstrand jason at jlekstrand.net
Tue Apr 4 22:56:32 UTC 2017


---
 src/intel/genxml/gen_bits_header.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py
index cfe2a89..fc31baa 100644
--- a/src/intel/genxml/gen_bits_header.py
+++ b/src/intel/genxml/gen_bits_header.py
@@ -113,6 +113,8 @@ extern "C" {
 
 ${emit_per_gen_prop_func(field, 'bits')}
 
+${emit_per_gen_prop_func(field, 'start')}
+
 % endfor
 % endfor
 
@@ -205,11 +207,13 @@ class Field(object):
         self.name = name
         self.token_name = safe_name('_'.join([container.name, self.name]))
         self.bits_by_gen = {}
+        self.start_by_gen = {}
 
     def add_gen(self, gen, xml_attrs):
         assert isinstance(gen, Gen)
         start = int(xml_attrs['start'])
         end = int(xml_attrs['end'])
+        self.start_by_gen[gen] = start
         self.bits_by_gen[gen] = 1 + end - start
 
     def has_prop(self, prop):
@@ -218,6 +222,8 @@ class Field(object):
     def iter_prop(self, prop):
         if prop == 'bits':
             return self.bits_by_gen.iteritems()
+        elif prop == 'start':
+            return self.start_by_gen.iteritems()
         else:
             raise ValueError('Invalid property: "{0}"'.format(prop))
 
@@ -227,6 +233,8 @@ class Field(object):
 
         if prop == 'bits':
             return self.bits_by_gen.get(gen, 0)
+        elif prop == 'start':
+            return self.start_by_gen.get(gen, 0)
         else:
             raise ValueError('Invalid property: "{0}"'.format(prop))
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list