[PATCH i-g-t 1/3] lib/igt_kms Added a function for HPD detection

Kunal Joshi kunal1.joshi at intel.com
Wed Aug 19 11:19:11 UTC 2020


Added igt_connector_hotplug_event_detected which returns a bool
if hotplug detected on a specified connector.

Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 lib/igt_kms.c | 22 ++++++++++++++++++++++
 lib/igt_kms.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f57972f1..746111d6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -4347,6 +4347,28 @@ bool igt_hotplug_detected(struct udev_monitor *mon, int timeout_secs)
 			      ARRAY_SIZE(props));
 }
 
+/**
+ * igt_connector_hotplug_event_detected:
+ * @mon: A udev monitor initialized with #igt_watch_uevents
+ * @conn_id: Connector id of the Connector for which the property change is
+ * expected.
+ * @timeout_secs: How long to wait for a connector event to occur.
+ *
+ * Detect if a connector hotplug event is received for a given connector
+ *
+ * Returns: true if the connector event was received, false if we timed out
+ */
+bool igt_connector_hotplug_event_detected(struct udev_monitor *mon,
+                                          uint32_t conn_id,
+                                          int timeout_secs)
+{
+        const char *props[2] = {"HOTPLUG", "CONNECTOR"};
+        int expected_val[2] = {1, conn_id};
+
+        return event_detected(mon, timeout_secs, props, expected_val,
+                              ARRAY_SIZE(props));
+}
+
 /**
  * igt_lease_change_detected:
  * @mon: A udev monitor initialized with #igt_watch_uevents
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 26dc9f5f..3aa7ee3b 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -795,6 +795,9 @@ bool igt_lease_change_detected(struct udev_monitor *mon,
 			       int timeout_secs);
 bool igt_connector_event_detected(struct udev_monitor *mon, uint32_t conn_id,
 				  uint32_t prop_id, int timeout_msecs);
+bool igt_connector_hotplug_event_detected(struct udev_monitor *mon,
+                                          uint32_t conn_id,
+                                          int timeout_secs);
 void igt_flush_uevents(struct udev_monitor *mon);
 void igt_cleanup_uevents(struct udev_monitor *mon);
 
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list