From 48cdad70d9404555c9bb545d9e6408c6aef707b0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 6 Sep 2010 10:27:55 +1000 Subject: r600g: add script to generate header file with offsets into state objects. This was inherently fragile as any changes to r600_states.h would also need manual updating of all of the bits in radeon.h. Just add a simple python script to do the conversion, its not hooked up to make at all. This also will make adding evergreen a bit easier. --- src/gallium/winsys/r600/drm/gen_r600_states.py | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/gallium/winsys/r600/drm/gen_r600_states.py (limited to 'src/gallium/winsys/r600/drm') diff --git a/src/gallium/winsys/r600/drm/gen_r600_states.py b/src/gallium/winsys/r600/drm/gen_r600_states.py new file mode 100644 index 00000000000..9bd5ab20825 --- /dev/null +++ b/src/gallium/winsys/r600/drm/gen_r600_states.py @@ -0,0 +1,39 @@ +import os +import re + +def main(): + fileIN = open('r600_states.h', 'r') + line = fileIN.readline() + next_is_reg = False + count = 0 + + print "/* This file is autogenerated from r600_states.h - do not edit directly */" + print "/* autogenerating script is gen_r600_states.py */" + print "" + while line: + if line[0:2] == "};": + if next_is_reg == True: + print "#define " + name + "_SIZE\t\t", count + print "#define " + name + "_PM4 128\t\t" + next_is_reg = False + count = 0 + print "" + + if line[0:6] == "static": + name = line.rstrip("\n") + cline = name.split() + name = cline[4].split('[') + name = name[0].replace("_names", "") + print "/* " + name + " */" + next_is_reg = True + elif next_is_reg == True: + reg = line.split(); + reg = reg[3].replace("},", "") + reg = reg.replace("\"", "") + print "#define " + name + "__" + reg + "\t\t", count + count = count + 1 + + line = fileIN.readline() + +if __name__ == "__main__": + main() -- cgit v1.2.3