[Mesa-dev] [PATCH 2/5] genxml: Fix decoder for groups with multiple fields.

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue May 30 22:45:03 UTC 2017


Patches 2-4 are :

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


On 20/05/17 08:24, Kenneth Graunke wrote:
> If you have something like:
>
>      <group count="0" start="96" size="32">
>        <field name="Entry_0" start="0" end="15" type="GATHER_CONSTANT_ENTRY"/>
>        <field name="Entry_1" start="16" end="31" type="GATHER_CONSTANT_ENTRY"/>
>      </group>
>
> We would reset ctx->group_count to 0 after processing the first field,
> so the second would not have a group count.
>
> This is largely untested, as the only groups with multiple fields are
> packets we don't emit in Mesa.  Found by inspection.
> ---
>   src/intel/common/gen_decoder.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
> index e1a2fcf9d11..ccfe46ae664 100644
> --- a/src/intel/common/gen_decoder.c
> +++ b/src/intel/common/gen_decoder.c
> @@ -414,11 +414,9 @@ start_element(void *data, const char *element_name, const char **atts)
>                                &ctx->group->group_count, &ctx->group->elem_size,
>                                &ctx->group->variable);
>      } else if (strcmp(element_name, "field") == 0) {
> -      do {
> +      for (int g = 0; g < MAX2(ctx->group->group_count, 1); g++) {
>            ctx->fields[ctx->nfields++] = create_field(ctx, atts);
> -         if (ctx->group->group_count)
> -            ctx->group->group_count--;
> -      } while (ctx->group->group_count > 0);
> +      }
>      } else if (strcmp(element_name, "enum") == 0) {
>         ctx->enoom = create_enum(ctx, name, atts);
>      } else if (strcmp(element_name, "value") == 0) {




More information about the mesa-dev mailing list