summaryrefslogtreecommitdiffstats
path: root/src/intel/genxml/gen_bits_header.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/genxml/gen_bits_header.py')
-rw-r--r--src/intel/genxml/gen_bits_header.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py
index aac49fb49e2..8c87edb2e55 100644
--- a/src/intel/genxml/gen_bits_header.py
+++ b/src/intel/genxml/gen_bits_header.py
@@ -266,6 +266,10 @@ class XmlParser(object):
if name == 'genxml':
self.gen = Gen(attrs['gen'])
elif name in ('instruction', 'struct', 'register'):
+ if name == 'instruction' and 'engine' in attrs:
+ engines = set(attrs['engine'].split('|'))
+ if not engines & self.engines:
+ return
self.start_container(attrs)
elif name == 'field':
self.start_field(attrs)
@@ -304,6 +308,8 @@ def parse_args():
help="If OUTPUT is unset or '-', then it defaults to '/dev/stdout'")
p.add_argument('--cpp-guard', type=str,
help='If unset, then CPP_GUARD is derived from OUTPUT.')
+ p.add_argument('--engines', nargs='?', type=str, default='render',
+ help="Comma-separated list of engines whose instructions should be parsed (default: %(default)s)")
p.add_argument('xml_sources', metavar='XML_SOURCE', nargs='+')
pargs = p.parse_args()
@@ -319,11 +325,21 @@ def parse_args():
def main():
pargs = parse_args()
+ engines = pargs.engines.split(',')
+ valid_engines = [ 'render', 'blitter', 'video' ]
+ if set(engines) - set(valid_engines):
+ print("Invalid engine specified, valid engines are:\n")
+ for e in valid_engines:
+ print("\t%s" % e)
+ sys.exit(1)
+
# Maps name => Container
containers = {}
for source in pargs.xml_sources:
- XmlParser(containers).parse(source)
+ p = XmlParser(containers)
+ p.engines = set(engines)
+ p.parse(source)
with open(pargs.output, 'wb') as f:
f.write(TEMPLATE.render(containers=containers, guard=pargs.cpp_guard))