[Mesa-dev] [PATCH] intel: genxml: index fields using their safe name

Jason Ekstrand jason at jlekstrand.net
Fri Sep 1 15:17:39 UTC 2017


I didn't do this before precisely to force us to keep the XML consistent.


On September 1, 2017 2:38:27 AM Lionel Landwerlin 
<lionel.g.landwerlin at intel.com> wrote:

> With a slightly different capitalization of an additional space, 2
> fields having the same safe name might not be grouped together. This
> leads to multiple *_bits() functions with the same name. We can
> prevent this by indexing fields with their safe name.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  src/intel/genxml/gen_bits_header.py | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/intel/genxml/gen_bits_header.py 
> b/src/intel/genxml/gen_bits_header.py
> index 1b3504073b0..471cdace2a9 100644
> --- a/src/intel/genxml/gen_bits_header.py
> +++ b/src/intel/genxml/gen_bits_header.py
> @@ -204,12 +204,13 @@ class Container(object):
>              self.length_by_gen[gen] = xml_attrs['length']
>
>      def get_field(self, field_name, create=False):
> -        if field_name not in self.fields:
> +        safe_field_name = safe_name(field_name)
> +        if safe_field_name not in self.fields:
>              if create:
> -                self.fields[field_name] = Field(self, field_name)
> +                self.fields[safe_field_name] = Field(self, field_name)
>              else:
>                  return None
> -        return self.fields[field_name]
> +        return self.fields[safe_field_name]
>
>      def has_prop(self, prop):
>          if prop == 'length':
> --
> 2.14.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list