From: Damien Lespiau Subject: [PATCH igt 04/28] lib: Introduce a for_each_connected_output() macro Date: Fri, 7 Feb 2014 14:48:48 +0000 Message-ID: <1391784552-21308-5-git-send-email-damien.lespiau@intel.com> References: <1391784552-21308-1-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id CB1C0FBAC9 for ; Fri, 7 Feb 2014 06:49:42 -0800 (PST) In-Reply-To: <1391784552-21308-1-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 --- 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