[igt-dev] [PATCH i-g-t 3/5] lib/drmtest: Introduced drm_open_driver_another

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 13 18:57:30 UTC 2023


From: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>

Introduced drm_open_driver_another as a wrapper for
__drm_open_driver_another with successful open assert.

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 e1da66c87..22e3aada1 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -627,6 +627,25 @@ static const char *chipset_to_str(int chipset)
 	}
 }
 
+/*
+ * 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 97ab6e759..38dc0e1bf 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_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