[igt-dev] [PATCH 2/3] lib/drmtest: Add drm_find_chipset()
Kamil Konieczny
kamil.konieczny at linux.intel.com
Wed Sep 27 16:21:10 UTC 2023
Hi Rob,
On 2023-09-26 at 11:47:46 -0700, Rob Clark wrote:
> From: Rob Clark <robdclark at chromium.org>
>
> Add helper to map driver name to chipset.
>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Signed-off-by: Rob Clark <robdclark at chromium.org>
> ---
> lib/drmtest.c | 14 ++++++++++++++
> lib/drmtest.h | 1 +
> 2 files changed, 15 insertions(+)
>
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 2cfa8a899d53..4d826df744ae 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -608,6 +608,20 @@ static const char *chipset_to_str(int chipset)
> return (chipset == DRIVER_ANY) ? "any" : "other";
> }
>
> +/**
> + * drm_find_chipset:
> + * @name: The driver name
> + *
> + * Map the driver name to DRIVER_xyz value.
> + */
> +int drm_find_chipset(const char *name)
> +{
> + for (const struct module *m = modules; m->module; m++)
> + if (!strcmp(name, m->module))
> + return m->bit;
> + return 0;
> +}
> +
> /**
> * drm_open_driver:
> * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index 97ab6e759edf..9a71e1041ce8 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -99,6 +99,7 @@ void __set_forced_driver(const char *name);
> #define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
>
> void drm_load_module(unsigned int chipset);
> +int drm_find_chipset(const char *name);
> int drm_open_driver(int chipset);
> int drm_open_driver_master(int chipset);
> int drm_open_driver_render(int chipset);
> --
> 2.41.0
>
More information about the igt-dev
mailing list