[Mesa-dev] [PATCH v2 3/3] loader: add drirc option to override dri driver to load

Emil Velikov emil.l.velikov at gmail.com
Fri Aug 3 11:00:19 UTC 2018


Hi Qiang Yu,

Couple of suggestions mentioned before apply here as well.

On 3 August 2018 at 09:19, Qiang Yu <Qiang.Yu at amd.com> wrote:
> v2:
>   add kernel_driver device attribute to specify kernel
>   driver name instead of reuse driver attribute.
>
Please move to the end of the commit message.

Can you split things up a bit:
 - refactoring - to reduce the ifdef hunk, simply add no-op func. stubs
 - the new dri_driver handling - loader_get_dri_config_driver will use
NULL for kernel_driver
 - the new kernel_driver handling

> +static char *loader_get_dri_config_driver(int fd)
> +{
> +   driOptionCache defaultInitOptions;
> +   driOptionCache userInitOptions;
> +   char *dri_driver = NULL;
> +   char *kernel_driver = loader_get_kernel_driver_name(fd);
> +
> +   driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
> +   driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
> +                       "loader", kernel_driver);
> +   if (driCheckOption(&userInitOptions, "dri_driver", DRI_STRING)) {
> +      char *opt = driQueryOptionstr(&userInitOptions, "dri_driver");
> +      /* not an empty string */
> +      if (*opt)
> +         dri_driver = strdup(opt);
> +   }
> +   driDestroyOptionCache(&userInitOptions);
> +   driDestroyOptionInfo(&defaultInitOptions);
> +
> +   if (kernel_driver)
Nit: free(NULL) is safe, drop the check.

HTH
Emil


More information about the mesa-dev mailing list