Mesa (master): genxml: Fix decoding of array groups.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jun 1 18:57:13 UTC 2017


Module: Mesa
Branch: master
Commit: 73c21e69d0c132a6d837b40b6a863bdd406085d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=73c21e69d0c132a6d837b40b6a863bdd406085d4

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri May 19 15:31:35 2017 -0700

genxml: Fix decoding of array groups.

If you had a group as the first element of a struct, i.e.

  <struct name="3DSTATE_CONSTANT_BODY" length="10">
    <group count="4" start="0" size="16">
      <field name="ReadLength" start="0" end="15" type="uint"/>
    </group>
    ...
  </struct>

we would get a group_offset of 0, causing create_field() to think the
field wasn't in a group, and fail to offset forward for successive array
elements.  So we'd mark all the array elements as offset 0.

Using ctx->group->elem_size is a better check for "are we in a group?".

Acked-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

---

 src/intel/common/gen_decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index de50c4466b..f419b2118a 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -339,7 +339,7 @@ create_field(struct parser_context *ctx, const char **atts)
          field->start = ctx->group->group_offset+strtoul(atts[i + 1], &p, 0);
       else if (strcmp(atts[i], "end") == 0) {
          field->end = ctx->group->group_offset+strtoul(atts[i + 1], &p, 0);
-         if (ctx->group->group_offset) {
+         if (ctx->group->elem_size > 0) {
             ctx->group->group_offset = field->end+1;
             if (ctx->group->variable)
                ctx->group->variable_offset = ctx->group->group_offset;




More information about the mesa-commit mailing list