summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorLyude <lyude@redhat.com>2016-12-29 19:25:31 -0500
committerLyude <lyude@redhat.com>2017-01-26 11:22:37 -0500
commit528cdaf063546d0a32cfad6d215db62111054619 (patch)
tree5f057cec150fe778f49220bf51482e0ba609ace6 /lib/igt_kms.c
parent6adb7b3737297a32bef50ffb270b83fc314cca6b (diff)
igt_kms: Add igt_output_from_connector()
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>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index df90ca72..b6cb299b 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;