All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>,
	Thomas Wood <thomas.wood@intel.com>
Subject: [PATCH i-g-t v2] lib/igt_kms: Introduce get_first_connected_output macro
Date: Fri, 20 Nov 2015 18:56:50 -0800	[thread overview]
Message-ID: <1448074610-8661-1-git-send-email-vivek.kasireddy@intel.com> (raw)
In-Reply-To: <CANkqdn14z4VV5=k+qKEQXeOrCYF9wJVeAYaqujysH-P=cSaugQ@mail.gmail.com>

In some cases, we just need one valid (connected) output to perform
a test. This macro can help in these situations by not having to
put the test code inside a for loop that iterates over all the outputs.

v2: Added a brief documentation for this macro.

Suggested-by: Matt Roper <matthew.d.roper at intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
 lib/igt_kms.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 965c47c..a0bb066 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -279,6 +279,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 	for (int i__ = 0; (plane) = &(display)->pipes[(pipe)].planes[i__], \
 		     i__ < (display)->pipes[(pipe)].n_planes; i__++)
 
+/**
+ * get_first_connected_output:
+ * @display: Initialized igt_display_t type object
+ * @output: igt_output_t type object
+ *
+ * Returns: First valid (connected) output.
+ */
+#define get_first_connected_output(display, output)		\
+	for (int i__ = 0;  i__ < (display)->n_outputs; i__++)	\
+		if ((output = &(display)->outputs[i__]), output->valid) \
+			break
+
 #define IGT_FIXED(i,f)	((i) << 16 | (f))
 
 void igt_enable_connectors(void);
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-21  3:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29  2:09 [PATCH] lib/igt_kms: Introduce get_first_connected_output to retrieve a valid output Vivek Kasireddy
2015-10-29 11:05 ` Thomas Wood
2015-11-05  1:34   ` [PATCH] igt/igt_kms: Introduce get_first_connected_output (v2) Vivek Kasireddy
2015-11-13 15:59     ` Thomas Wood
2015-11-14  3:08       ` Vivek Kasireddy
2015-11-16 13:30         ` Thomas Wood
2015-11-21  2:56           ` Vivek Kasireddy [this message]
2015-11-23 13:49             ` [PATCH i-g-t v2] lib/igt_kms: Introduce get_first_connected_output macro Ander Conselvan De Oliveira
2015-11-24 12:20               ` Daniel Vetter
2015-11-24 13:03             ` Ville Syrjälä
2015-11-21  2:58           ` [PATCH i-g-t] tests/kms_rotation_crc: Use " Vivek Kasireddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448074610-8661-1-git-send-email-vivek.kasireddy@intel.com \
    --to=vivek.kasireddy@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.wood@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.