All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude <lyude@redhat.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lyude <lyude@redhat.com>
Subject: [RESEND PATCH i-g-t 3/5] igt_kms: Add igt_output_from_connector
Date: Fri, 20 Jan 2017 13:58:22 -0500	[thread overview]
Message-ID: <20170120185824.12692-4-lyude@redhat.com> (raw)
In-Reply-To: <20170120185824.12692-1-lyude@redhat.com>

A simple helper for getting the igt_output_t struct corresponding to the
given DRM connector id.

Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Signed-off-by: Lyude <lyude@redhat.com>
---
 lib/igt_kms.c | 26 ++++++++++++++++++++++++++
 lib/igt_kms.h |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e36c0b8..80b7939 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1686,6 +1686,32 @@ int igt_display_get_n_pipes(igt_display_t *display)
 	return display->n_pipes;
 }
 
+/**
+ * igt_output_from_connector:
+ * @display: a pointer to an #igt_display_t structure
+ * @connector: a pointer to a drmModeConnector
+ *
+ * Finds the output corresponding to the given connector
+ *
+ * Returns: A #igt_output_t structure configured to use the connector, or NULL
+ * if none was found
+ */
+igt_output_t *igt_output_from_connector(igt_display_t *display,
+					drmModeConnector *connector)
+{
+	igt_output_t *output, *found = NULL;
+
+	for_each_connected_output(display, output) {
+		if (output->config.connector->connector_id ==
+		    connector->connector_id) {
+			found = output;
+			break;
+		}
+	}
+
+	return found;
+}
+
 static void igt_pipe_fini(igt_pipe_t *pipe)
 {
 	int i;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 53cc900..d1aee07 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -354,6 +354,8 @@ void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode);
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
 void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode);
 igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane);
+igt_output_t *igt_output_from_connector(igt_display_t *display,
+					drmModeConnector *connector);
 bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
 			   uint32_t *prop_id, uint64_t *value,
 			   drmModePropertyPtr *prop);
-- 
2.9.3

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

  parent reply	other threads:[~2017-01-20 18:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 18:58 [RESEND PATCH i-g-t v4 0/5] Add support for the Chamelium Lyude
2017-01-20 18:58 ` [RESEND PATCH i-g-t v2 1/5] igt_aux: Add igt_set_autoresume_delay() Lyude
2017-01-20 18:58 ` [RESEND PATCH i-g-t v3 2/5] igt_kms: Add helpers for watching for sysfs hotplug events Lyude
2017-01-20 18:58 ` Lyude [this message]
2017-01-20 18:58 ` [RESEND PATCH i-g-t 4/5] igt_kms: Add kmstest_set_connector_broadcast_rgb() Lyude
2017-01-20 18:58 ` [RESEND PATCH i-g-t v4 5/5] Add support for hotplug testing with the Chamelium Lyude

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=20170120185824.12692-4-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.