aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-06-27 14:10:52 -0700
committerEric Anholt <[email protected]>2018-06-29 13:36:28 -0700
commit725561c0b6ccdf57190519c1ffcb653307ec08ec (patch)
tree3f4a480f5e36530978ade395deec0a4d45444dfa
parentf8af5c58c3aa83939b1e0f03d550ba63a9ea729e (diff)
v3d: Switch v3d_decoder.c to the XML's top min_ver/max_ver fields.
The XML zipper wants one XML per version for filling out its tables, but we want to do more than one GPU version per XML now. Assume that the "gen" field will be the same as min_ver and look up our XML text assuming that they're listed in increasing min_ver.
-rw-r--r--src/broadcom/cle/v3d_decoder.c12
-rw-r--r--src/broadcom/cle/v3d_packet_v21.xml2
-rw-r--r--src/broadcom/cle/v3d_packet_v33.xml2
-rw-r--r--src/broadcom/cle/v3d_packet_v41.xml2
-rw-r--r--src/broadcom/cle/v3d_packet_v42.xml2
5 files changed, 14 insertions, 6 deletions
diff --git a/src/broadcom/cle/v3d_decoder.c b/src/broadcom/cle/v3d_decoder.c
index d76c004730b..832ff3c7089 100644
--- a/src/broadcom/cle/v3d_decoder.c
+++ b/src/broadcom/cle/v3d_decoder.c
@@ -467,6 +467,10 @@ start_element(void *data, const char *element_name, const char **atts)
if (ver == NULL)
fail(&ctx->loc, "no ver given");
+ /* Make sure that we picked an XML that matched our version.
+ */
+ assert(ver_in_range(ctx->devinfo->ver, min_ver, max_ver));
+
int major, minor;
int n = sscanf(ver, "%d.%d", &major, &minor);
if (n == 0)
@@ -631,10 +635,14 @@ v3d_spec_load(const struct v3d_device_info *devinfo)
uint32_t text_offset = 0, text_length = 0, total_length;
for (int i = 0; i < ARRAY_SIZE(genxml_files_table); i++) {
- if (genxml_files_table[i].gen_10 == devinfo->ver) {
+ if (i != 0) {
+ assert(genxml_files_table[i - 1].gen_10 <
+ genxml_files_table[i].gen_10);
+ }
+
+ if (genxml_files_table[i].gen_10 <= devinfo->ver) {
text_offset = genxml_files_table[i].offset;
text_length = genxml_files_table[i].length;
- break;
}
}
diff --git a/src/broadcom/cle/v3d_packet_v21.xml b/src/broadcom/cle/v3d_packet_v21.xml
index 9ca983308d3..df838a70845 100644
--- a/src/broadcom/cle/v3d_packet_v21.xml
+++ b/src/broadcom/cle/v3d_packet_v21.xml
@@ -1,4 +1,4 @@
-<vcxml gen="2.1">
+<vcxml gen="2.1" min_ver="21" max_ver="21">
<enum name="Compare Function" prefix="V3D_COMPARE_FUNC">
<value name="NEVER" value="0"/>
diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml
index 1ece1c95558..2e112f4bac3 100644
--- a/src/broadcom/cle/v3d_packet_v33.xml
+++ b/src/broadcom/cle/v3d_packet_v33.xml
@@ -1,4 +1,4 @@
-<vcxml gen="3.3">
+<vcxml gen="3.3" min_ver="33" max_ver="33">
<enum name="Compare Function" prefix="V3D_COMPARE_FUNC">
<value name="NEVER" value="0"/>
diff --git a/src/broadcom/cle/v3d_packet_v41.xml b/src/broadcom/cle/v3d_packet_v41.xml
index 9f0c54eadc9..d509d974bc4 100644
--- a/src/broadcom/cle/v3d_packet_v41.xml
+++ b/src/broadcom/cle/v3d_packet_v41.xml
@@ -1,4 +1,4 @@
-<vcxml gen="4.1">
+<vcxml gen="4.1" min_ver="41" max_ver="41">
<enum name="Compare Function" prefix="V3D_COMPARE_FUNC">
<value name="NEVER" value="0"/>
diff --git a/src/broadcom/cle/v3d_packet_v42.xml b/src/broadcom/cle/v3d_packet_v42.xml
index 5a335d89c22..8bad4c533b6 100644
--- a/src/broadcom/cle/v3d_packet_v42.xml
+++ b/src/broadcom/cle/v3d_packet_v42.xml
@@ -1,4 +1,4 @@
-<vcxml gen="4.2">
+<vcxml gen="4.2" min_ver="42" max_ver="42">
<enum name="Compare Function" prefix="V3D_COMPARE_FUNC">
<value name="NEVER" value="0"/>