freedreno/rnn: allow name to be optional in arrays
authorRob Clark <robdclark@chromium.org>
Tue, 28 Jul 2020 18:01:02 +0000 (11:01 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 14:30:35 +0000 (14:30 +0000)
We are using unnamed arrays to describe repeating portions of a pm4
packet.  So allow the name to be optional.  Instead of just using
the empty-string hack, drop the attribute.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6107>

src/freedreno/registers/adreno/adreno_pm4.xml
src/freedreno/registers/gen_header.py
src/freedreno/registers/rules-ng.xsd
src/freedreno/rnn/rnn.c

index b3ccff223ca788723075e5f8da038330dd36f59d..24c95ee9d3286f5269df56ca0802d2ef15fca506 100644 (file)
@@ -833,7 +833,7 @@ opcode: CP_LOAD_STATE4 (30) (4 dwords)
 </domain>
 
 <domain name="CP_SET_DRAW_STATE" width="32" varset="chip" variants="A4XX-">
-       <array offset="0" name="" stride="3" length="100">
+       <array offset="0" stride="3" length="100">
                <reg32 offset="0" name="0">
                        <bitfield name="COUNT" low="0" high="15" type="uint"/>
                        <bitfield name="DIRTY" pos="16" type="boolean"/>
@@ -1497,7 +1497,7 @@ opcode: CP_LOAD_STATE4 (30) (4 dwords)
                <value value="3" name="NON_PRIV_SAVE_ADDR"/>
                <value value="4" name="COUNTER"/>
        </enum>
-       <array offset="0" name="" stride="3" length="100">
+       <array offset="0" stride="3" length="100">
                <reg32 offset="0" name="0">
                        <bitfield name="PSEUDO_REG" low="0" high="2" type="pseudo_reg"/>
                </reg32>
index 291f7e9d2999338b0a4ffd25e62b497cd288a4dc..c0fc47fd8b4e526439aa36690b246c72e070cf2e 100644 (file)
@@ -227,7 +227,10 @@ class Bitset(object):
 
 class Array(object):
        def __init__(self, attrs, domain):
-               self.name = attrs["name"]
+               if "name" in attrs:
+                       self.name = attrs["name"]
+               else:
+                       self.name = ""
                self.domain = domain
                self.offset = int(attrs["offset"], 0)
                self.stride = int(attrs["stride"], 0)
index 4e3651d6f32358be5b702c81d45f6b80229ee783..3a8094f91b1b9888379a5ef8878489da97047594 100644 (file)
                        <group ref="rng:topGroup" />\r
                        <group ref="rng:regarrayGroup" />\r
                </choice>\r
-               <attribute name="name" type="NMTOKEN" use="required" />\r
+               <attribute name="name" type="NMTOKEN" use="optional" />\r
                <attribute name="offset" type="rng:HexOrNumber" use="required" />\r
                <attribute name="stride" type="rng:HexOrNumber" use="required" />\r
                <attribute name="length" type="rng:HexOrNumber" use="required" />\r
index 17abf79715c086bee467eb47ed3f20fac4392518..1a1103706d90a291a59b9fc8290a52f621c7a0cc 100644 (file)
@@ -481,6 +481,8 @@ static struct rnndelem *trydelem(struct rnndb *db, char *file, xmlNode *node) {
                return res;
        } else if (!strcmp(node->name, "stripe") || !strcmp(node->name, "array")) {
                struct rnndelem *res = calloc(sizeof *res, 1);
+               if (!strcmp(node->name, "array"))
+                       res->name = "";
                res->type = (strcmp(node->name, "stripe")?RNN_ETYPE_ARRAY:RNN_ETYPE_STRIPE);
                res->length = 1;
                res->file = file;