summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-06 10:27:55 +1000
committerDave Airlie <airlied@redhat.com>2010-09-06 10:28:08 +1000
commit48cdad70d9404555c9bb545d9e6408c6aef707b0 (patch)
tree0d90cbba8416c480c33f08875b0abb104d6906a4 /src/gallium/winsys
parent5b82777311965d26e534bd522afb0f679622d504 (diff)
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.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/r600/drm/gen_r600_states.py39
1 files changed, 39 insertions, 0 deletions
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 0000000000..9bd5ab2082
--- /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()