Mesa (master): freedreno/rnn: add relaxed boolean type
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 29 14:50:08 UTC 2020
Module: Mesa
Branch: master
Commit: 61ae65a73d4a4ddba05c3531de94cf2974fb83a7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=61ae65a73d4a4ddba05c3531de94cf2974fb83a7
Author: Rob Clark <robdclark at chromium.org>
Date: Tue Jul 28 09:47:38 2020 -0700
freedreno/rnn: add relaxed boolean type
In the schema, boolean means strictly "true" or "false". But rnn
parsing code was looking for "yes"/"1"/"no"/"0". So split the
difference, and add a relaxed boolean type, and update rnn to also
accept "true" or "false".
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6107>
---
src/freedreno/registers/rules-ng.xsd | 21 ++++++++++++++++-----
src/freedreno/rnn/rnn.c | 4 ++--
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/freedreno/registers/rules-ng.xsd b/src/freedreno/registers/rules-ng.xsd
index a5a33412aed..e5f80efaee5 100644
--- a/src/freedreno/registers/rules-ng.xsd
+++ b/src/freedreno/registers/rules-ng.xsd
@@ -80,7 +80,7 @@
<group ref="rng:regarrayGroup" />
</choice>
<attribute name="name" type="NMTOKEN" use="required" />
- <attribute name="bare" type="boolean" use="optional" />
+ <attribute name="bare" type="rng:Boolean" use="optional" />
<attribute name="prefix" type="NMTOKENS" use="optional" />
<attribute name="width" type="rng:DomainWidth" use="optional" />
<attribute name="size" type="rng:Hexadecimal" use="optional" />
@@ -166,8 +166,8 @@
<group ref="rng:topGroup" />
</choice>
<attribute name="name" type="NMTOKEN" use="required" />
- <attribute name="inline" type="boolean" use="optional" />
- <attribute name="bare" type="boolean" use="optional" />
+ <attribute name="inline" type="rng:Boolean" use="optional" />
+ <attribute name="bare" type="rng:Boolean" use="optional" />
<attribute name="prefix" type="NMTOKENS" use="optional" />
</complexType>
@@ -200,8 +200,8 @@
<group ref="rng:topGroup" />
</choice>
<attribute name="name" type="NMTOKEN" use="required" />
- <attribute name="inline" type="boolean" use="optional" />
- <attribute name="bare" type="boolean" use="optional" />
+ <attribute name="inline" type="rng:Boolean" use="optional" />
+ <attribute name="bare" type="rng:Boolean" use="optional" />
<attribute name="prefix" type="NMTOKENS" use="optional" />
</complexType>
@@ -315,6 +315,17 @@
<union memberTypes="rng:Hexadecimal nonNegativeInteger" />
</simpleType>
+ <simpleType name="Boolean">
+ <restriction base="string">
+ <enumeration value="true" />
+ <enumeration value="1" />
+ <enumeration value="yes" />
+ <enumeration value="false" />
+ <enumeration value="0" />
+ <enumeration value="no" />
+ </restriction>
+ </simpleType>
+
<simpleType name="Access">
<annotation>
<documentation>Access</documentation>
diff --git a/src/freedreno/rnn/rnn.c b/src/freedreno/rnn/rnn.c
index d6ba6fa5005..17abf79715c 100644
--- a/src/freedreno/rnn/rnn.c
+++ b/src/freedreno/rnn/rnn.c
@@ -124,9 +124,9 @@ static char *getattrib (struct rnndb *db, char *file, int line, xmlAttr *attr) {
static int getboolattrib (struct rnndb *db, char *file, int line, xmlAttr *attr) {
char *c = getattrib(db, file, line, attr);
- if (!strcmp(c, "yes") || !strcmp(c, "1"))
+ if (!strcmp(c, "yes") || !strcmp(c, "1") || !strcmp(c, "true"))
return 1;
- if (!strcmp(c, "no") || !strcmp(c, "0"))
+ if (!strcmp(c, "no") || !strcmp(c, "0") || !strcmp(c, "false"))
return 0;
rnn_err(db, "%s:%d: invalid boolean value \"%s\" in attribute \"%s\"\n", file, line, c, attr->name);
return 0;
More information about the mesa-commit
mailing list