[Mesa-dev] [PATCH 3/4] intel/decoder: construct correct xml filename

Lionel Landwerlin lionel.g.landwerlin at intel.com
Wed Sep 5 17:32:24 UTC 2018


On 05/09/2018 18:19, Sagar Ghuge wrote:
> construct correct gen xml filename when we try to load hardware xml
> description from a given path
>
> Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>


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


> ---
>   src/intel/common/gen_decoder.c | 18 ++++++++++++------
>   1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
> index c44b8f060d..e2509cbd87 100644
> --- a/src/intel/common/gen_decoder.c
> +++ b/src/intel/common/gen_decoder.c
> @@ -463,12 +463,18 @@ character_data(void *data, const XML_Char *s, int len)
>   }
>   
>   static int
> -devinfo_to_gen(const struct gen_device_info *devinfo)
> +devinfo_to_gen(const struct gen_device_info *devinfo, bool x10)
>   {
> -   int value = 10 * devinfo->gen;
> +   int value = devinfo->gen;
>   
> -   if (devinfo->is_baytrail || devinfo->is_haswell)
> -      value += 5;
> +   if (x10)
> +      value  = 10 * devinfo->gen;
> +
> +   if (devinfo->is_baytrail || devinfo->is_haswell) {
> +         if (!x10)
> +            value *= 10;
> +         value += 5;
> +   }
>   
>      return value;
>   }
> @@ -558,7 +564,7 @@ gen_spec_load(const struct gen_device_info *devinfo)
>      uint8_t *text_data = NULL;
>      uint32_t text_offset = 0, text_length = 0;
>      MAYBE_UNUSED uint32_t total_length;
> -   uint32_t gen_10 = devinfo_to_gen(devinfo);
> +   uint32_t gen_10 = devinfo_to_gen(devinfo, true);
>   
>      for (int i = 0; i < ARRAY_SIZE(genxml_files_table); i++) {
>         if (genxml_files_table[i].gen_10 == gen_10) {
> @@ -627,7 +633,7 @@ gen_spec_load_from_path(const struct gen_device_info *devinfo,
>      FILE *input;
>   
>      len = snprintf(filename, filename_len, "%s/gen%i.xml",
> -                  path, devinfo_to_gen(devinfo));
> +                  path, devinfo_to_gen(devinfo, false));
>      assert(len < filename_len);
>   
>      input = fopen(filename, "r");




More information about the mesa-dev mailing list