[Intel-gfx] [PATCH igt 04/28] lib: Introduce a for_each_connected_output() macro

Damien Lespiau damien.lespiau at intel.com
Fri Feb 7 15:48:48 CET 2014


So we can easily cycle through them in tests without knowing too many
internal details about how igt_display_t organize its data.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 lib/igt_kms.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 80cdfb6..1d06767 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -158,5 +158,9 @@ igt_plane_t *igt_ouput_get_plane(igt_output_t *output, enum igt_plane plane);
 
 void igt_plane_set_fb(igt_plane_t *plane, struct kmstest_fb *fb);
 
+#define for_each_connected_output(display, output)		\
+	for (int i__ = 0;  i__ < (display)->n_outputs; i__++)	\
+		if ((output = &(display)->outputs[i__]), output->valid)
+
 #endif /* __IGT_KMS_H__ */
 
-- 
1.8.3.1




More information about the Intel-gfx mailing list