[PATCH i-g-t v2 3/8] lib/drmtest: Allow to get drm device name

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Aug 5 14:37:06 UTC 2024


Make this a public function so in tests developers could use it
instead of hard-coding driver names (such as "i915" or "xe").

Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>
---
 lib/drmtest.c | 14 +++++++++++++-
 lib/drmtest.h |  2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 8ea96ba76..2dd4540b8 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -81,7 +81,19 @@
  * and [batchbuffer](igt-gpu-tools-intel-batchbuffer.html) libraries as dependencies.
  */
 
-static int __get_drm_device_name(int fd, char *name, int name_size)
+/**
+ * __get_drm_device_name:
+ * @fd: a drm file descriptor
+ * @name: pointer to memory
+ * @name_size: size of @name
+ *
+ * A wrapper for DRM_IOCTL_VERSION which will write drm device name in @name.
+ *
+ * Returns:
+ * 0  if name of DRM driver was filled in @name
+ * -1 on ioctl fail
+ */
+int __get_drm_device_name(int fd, char *name, int name_size)
 {
 	drm_version_t version;
 
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 4d9b60882..27e5a18e2 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -38,6 +38,8 @@
 
 #include "igt_core.h"
 
+int __get_drm_device_name(int fd, char *name, int name_size);
+
 /*
  * NOTE: Theser are _only_ for testcases exercising driver specific rendering
  * ioctls and uapi (and a bunch of historical reasons). And KMS testcase should
-- 
2.43.0



More information about the igt-dev mailing list