[PATCH i-g-t v8 2/8] lib/drmtest: Introduced drm_open_driver_another

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Feb 9 08:56:17 UTC 2024


On Thu, Feb 08, 2024 at 02:52:26PM +0100, Kamil Konieczny wrote:
> From: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
> 
> For user convenience, introduce drm_open_driver_another as
> a wrapper for __drm_open_driver_another with successful open
> assert.

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

> 
> v2: rebased (Kamil)
> v6: reword description (Janusz)
> 
> Cc: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  lib/drmtest.c | 19 +++++++++++++++++++
>  lib/drmtest.h |  1 +
>  2 files changed, 20 insertions(+)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 52b5a2020..73d9159af 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -563,6 +563,25 @@ int __drm_open_driver_another(int idx, int chipset)
>  	return fd;
>  }
>  
> +/*
> + * drm_open_driver_another
> + * @idx: index of the device you are opening
> + * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
> + *
> + * A wrapper for __drm_open_driver with successful open assert.
> + *
> + * Returns:
> + * An open DRM fd
> + */
> +int drm_open_driver_another(int idx, int chipset)
> +{
> +	int fd = __drm_open_driver_another(idx, chipset);
> +
> +	igt_assert_fd(fd);
> +
> +	return fd;
> +}
> +
>  /**
>   * __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 6bc819734..856208c48 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -101,6 +101,7 @@ void __set_forced_driver(const char *name);
>  
>  int __drm_open_device(const char *name, unsigned int chipset);
>  void drm_load_module(unsigned int chipset);
> +int drm_open_driver_another(int idx, int chipset);
>  int drm_open_driver(int chipset);
>  int drm_open_driver_master(int chipset);
>  int drm_open_driver_render(int chipset);
> -- 
> 2.42.0
> 


More information about the igt-dev mailing list