[PATCH i-g-t v2 34/39] lib/chamelium/v3: Implement method to discover video signal status
Louis Chauvet
louis.chauvet at bootlin.com
Tue Jul 9 15:34:50 UTC 2024
The Chamelium can record signals received on its ports. This commit
introduces DetectResolution and WaitVideoInputStable RPC calls to utilize
this functionality, allowing users to monitor and manage video signal
status.
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
lib/chamelium/v3/igt_chamelium.c | 54 ++++++++++++++++++++++++++++++++++++++++
lib/chamelium/v3/igt_chamelium.h | 5 +++-
2 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/lib/chamelium/v3/igt_chamelium.c b/lib/chamelium/v3/igt_chamelium.c
index cf9eb330efe4..436a3cba139e 100644
--- a/lib/chamelium/v3/igt_chamelium.c
+++ b/lib/chamelium/v3/igt_chamelium.c
@@ -1119,3 +1119,57 @@ void chamelium_v3_apply_edid(struct igt_chamelium_v3 *chamelium,
igt_debug("RPC ApplyEdid(%d, %d)\n", port_id, edid_id);
xmlrpc_DECREF(__chamelium_rpc(chamelium, "ApplyEdid", "(ii)", port_id, edid_id));
}
+
+/**
+ * chamelium_v3_port_get_resolution - Get the resolution of a signal on a specific port
+ *
+ * @chamelium: Chamelium to use
+ * @port_id: Port to fetch the resolution
+ * @x: Out parameter for the width of the signal
+ * @y: Out parameter for the height of the signal
+ */
+void chamelium_v3_port_get_resolution(struct igt_chamelium_v3 *chamelium,
+ chamelium_v3_port_id port_id,
+ int *x, int *y)
+{
+ xmlrpc_value *res, *res_x, *res_y;
+
+ igt_debug("RPC DetectResolution(%d)\n", port_id);
+ res = __chamelium_rpc(chamelium, "DetectResolution", "(i)",
+ port_id);
+
+ xmlrpc_array_read_item(&chamelium->env, res, 0, &res_x);
+ xmlrpc_array_read_item(&chamelium->env, res, 1, &res_y);
+ xmlrpc_read_int(&chamelium->env, res_x, x);
+ xmlrpc_read_int(&chamelium->env, res_y, y);
+
+ xmlrpc_DECREF(res_x);
+ xmlrpc_DECREF(res_y);
+ xmlrpc_DECREF(res);
+}
+
+/**
+ * chamelium_v3_port_wait_video_input_stable - Get the resolution of a signal on a specific port
+ *
+ * @chamelium: Chamelium to use
+ * @port_id: Port to fetch the resolution
+ * @timeout_secs: Timeout to wait before returning
+ *
+ * Returns true if a signal is properly detected by the chamelium on the port @port_id
+ */
+bool chamelium_v3_port_wait_video_input_stable(struct igt_chamelium_v3 *chamelium,
+ chamelium_v3_port_id port_id,
+ int timeout_secs)
+{
+ xmlrpc_value *res;
+ xmlrpc_bool is_on;
+
+ igt_debug("RPC WaitVideoInputStable(%d, %d)\n", port_id, timeout_secs);
+ res = __chamelium_rpc(chamelium, "WaitVideoInputStable", "(ii)",
+ port_id, timeout_secs);
+
+ xmlrpc_read_bool(&chamelium->env, res, &is_on);
+ xmlrpc_DECREF(res);
+
+ return is_on;
+}
diff --git a/lib/chamelium/v3/igt_chamelium.h b/lib/chamelium/v3/igt_chamelium.h
index 0d2e481f6cca..bc0645f882c0 100644
--- a/lib/chamelium/v3/igt_chamelium.h
+++ b/lib/chamelium/v3/igt_chamelium.h
@@ -80,5 +80,8 @@ chamelium_edid_id chamelium_v3_create_edid(struct igt_chamelium_v3 *chamelium,
const struct edid *edid);
void chamelium_v3_apply_edid(struct igt_chamelium_v3 *chamelium, chamelium_v3_port_id port_id,
chamelium_edid_id edid_id);
-
+void chamelium_v3_port_get_resolution(struct igt_chamelium_v3 *chamelium,
+ chamelium_v3_port_id port_id, int *x, int *y);
+bool chamelium_v3_port_wait_video_input_stable(struct igt_chamelium_v3 *chamelium,
+ chamelium_v3_port_id port_id, int timeout_secs);
#endif //V3_IGT_CHAMELIUM_H
--
2.44.2
More information about the igt-dev
mailing list