[igt-dev] [i-g-t] lib/igt_kms: New api to iterate over all outputs

Bhanuprakash Modem bhanuprakash.modem at intel.com
Thu Sep 29 14:30:18 UTC 2022


Few KMS tests are trying to run on all outputs irrespective of
their connection status. So add a new helper to iterate over all
outputs.

Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 lib/igt_kms.h | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3d78c37f..e0786aad 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -544,16 +544,26 @@ static inline bool igt_output_is_connected(igt_output_t *output)
 #define for_each_if(condition) if (!(condition)) {} else
 
 /**
- * for_each_connected_output:
+ * for_each_output:
  * @display: a pointer to an #igt_display_t structure
  * @output: The output to iterate.
  *
  * This for loop iterates over all outputs.
  */
-#define for_each_connected_output(display, output)		\
+#define for_each_output(display, output)		\
 	for (int i__ = 0;  assert(igt_can_fail()), i__ < (display)->n_outputs; i__++)	\
-		for_each_if ((((output) = &(display)->outputs[i__]), \
-			      igt_output_is_connected((output))))
+		for_each_if (((output) = (&(display)->outputs[i__])))
+
+/**
+ * for_each_connected_output:
+ * @display: a pointer to an #igt_display_t structure
+ * @output: The output to iterate.
+ *
+ * This for loop iterates over all connected outputs.
+ */
+#define for_each_connected_output(display, output)		\
+	for_each_output((display), (output))	\
+		for_each_if ((igt_output_is_connected((output))))
 
 /**
  * for_each_pipe_static:
-- 
2.37.3



More information about the igt-dev mailing list