[PATCH i-g-t 1/2] lib/igt_kms: add igt_display_require_physical_output()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Mon Dec 9 21:16:19 UTC 2024


Add special version of igt_display_require_*_output()
which will ignore "Virtual" connector.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 lib/igt_kms.c | 21 +++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 22 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 22b6534e6..9dc6e6d3a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3153,6 +3153,27 @@ void igt_display_require_output(igt_display_t *display)
 	igt_skip("No valid crtc/connector combinations found.\n");
 }
 
+/**
+ * igt_display_require_physical_output:
+ * @display: A pointer to an #igt_display_t structure
+ *
+ * Checks whether there's a valid @pipe/@output combination for the given @display
+ * Virtual connector will not be accepted.
+ * Skips test if a valid combination of @pipe and @output is not found
+ */
+void igt_display_require_physical_output(igt_display_t *display)
+{
+	enum pipe pipe;
+	igt_output_t *output;
+
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		if (!strstr(output->name, "Virtual"))
+			return;
+	}
+
+	igt_skip("No valid crtc/connector combinations found.\n");
+}
+
 /**
  * igt_display_require_output_on_pipe:
  * @display: A pointer to an #igt_display_t structure
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 301f370df..89f4dfbdd 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -538,6 +538,7 @@ int  igt_display_try_commit2(igt_display_t *display, enum igt_commit_style s);
 int  igt_display_drop_events(igt_display_t *display);
 int  igt_display_get_n_pipes(igt_display_t *display);
 void igt_display_require_output(igt_display_t *display);
+void igt_display_require_physical_output(igt_display_t *display);
 void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe);
 
 const char *igt_output_name(igt_output_t *output);
-- 
2.45.2



More information about the igt-dev mailing list