[PATCH i-g-t 3/5] igt_kms: Add igt_output_from_connector

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Cc: Tomeu Vizoso <tomeu@xxxxxxxxxxxxxxx>
Signed-off-by: Lyude <lyude@xxxxxxxxxx>
---
 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 df50451..95d16ef 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1684,6 +1684,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 72ed6a3..fd9ff87 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -353,6 +353,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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux