[PATCH i-g-t RFC 13/13] tests/chamelium: Add MST test
Louis Chauvet
louis.chauvet at bootlin.com
Wed Jun 5 14:30:25 UTC 2024
Introduce a test to check EDID on MST ports. This plug all the children in
the chamelium and apply a different EDID for each.
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
tests/chamelium/v3/kms_chamelium_v3_edid.c | 96 ++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/tests/chamelium/v3/kms_chamelium_v3_edid.c b/tests/chamelium/v3/kms_chamelium_v3_edid.c
index efd53b392f4f..b1685c1f2569 100644
--- a/tests/chamelium/v3/kms_chamelium_v3_edid.c
+++ b/tests/chamelium/v3/kms_chamelium_v3_edid.c
@@ -193,6 +193,82 @@ static void test_suspend_resume_edid_change(int drm_fd, struct igt_chamelium_rpc
collect_and_compare_edid(drm_fd, port_mapping, igt_kms_get_alt_edid());
}
+static void edid_mst(int drm_fd, struct igt_chamelium_rpc *chamelium, chamelium_port_id port_id)
+{
+ const struct edid *edid = igt_kms_get_base_edid();
+ chamelium_port_id *children_port_ids;
+ int edid_id;
+ int children_port_count = chamelium_get_children_rpc(chamelium, port_id,
+ &children_port_ids);
+
+ struct edid **modified_edids;
+
+ modified_edids = calloc(children_port_count + 1, sizeof(*modified_edids));
+ igt_assert(modified_edids);
+
+ for (int i = 0; i <= children_port_count; i++) {
+ modified_edids[i] = malloc(edid_get_size(edid));
+ memcpy(modified_edids[i], edid, edid_get_size(edid));
+ modified_edids[i]->serial[0] = i;
+ modified_edids[i]->serial[1] = i;
+ modified_edids[i]->serial[2] = i;
+ modified_edids[i]->serial[3] = i;
+ edid_update_checksum(modified_edids[i]);
+ }
+
+ chamelium_reset_rpc(chamelium);
+
+ edid_id = chamelium_create_edid_rpc(chamelium, modified_edids[0]);
+ igt_assert(edid_id);
+ chamelium_apply_edid_rpc(chamelium, port_id, edid_id);
+
+ for (int i = 0; i < children_port_count; i++) {
+ edid_id = chamelium_create_edid_rpc(chamelium, modified_edids[i + 1]);
+ igt_assert(edid_id);
+ chamelium_apply_edid_rpc(chamelium, children_port_ids[i], edid_id);
+ }
+
+ chamelium_plug_with_children_rpc(chamelium, port_id, children_port_ids,
+ children_port_count);
+ drmModeResPtr res = drmModeGetResources(drm_fd);
+
+ drmModeFreeResources(res);
+ sleep(3);
+ res = drmModeGetResources(drm_fd);
+ for (int i = 0; i <= children_port_count; i++) {
+ bool found = false;
+
+ for (int j = 0; j < res->count_connectors; j++) {
+ drmModeConnectorPtr connector = drmModeGetConnector(drm_fd,
+ res->connectors[j]);
+ uint64_t edid_blob_id;
+
+ igt_assert(kmstest_get_property(drm_fd, connector->connector_id,
+ DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
+ &edid_blob_id, NULL));
+ if (edid_blob_id != 0) {
+ drmModePropertyBlobPtr edid_blob = drmModeGetPropertyBlob(drm_fd,
+ edid_blob_id);
+
+ igt_assert(edid_blob);
+
+ if (memcmp(modified_edids[i], edid_blob->data,
+ edid_get_size(modified_edids[i])) == 0)
+ found = true;
+ }
+
+ drmModeFreeConnector(connector);
+ }
+
+ igt_assert_f(found, "No connector were found with the correct EDID.\n");
+
+ free(modified_edids[i]);
+ }
+
+ drmModeFreeResources(res);
+ free(modified_edids);
+}
+
igt_main {
struct igt_chamelium_rpc *chamelium;
@@ -316,6 +392,26 @@ igt_main {
}
}
+ igt_describe("Check if hotplug during sleeping are correctly handled");
+ igt_subtest_with_dynamic("DP-MST-edid-read") {
+ chamelium_port_id *port_ids;
+ int port_count;
+
+ port_count = chamelium_get_supported_ports_rpc(chamelium, &port_ids);
+ for (int j = 0; j < port_count; j++) {
+ if (chamelium_is_mst_rpc(chamelium, port_ids[j])) {
+ igt_dynamic_f("port-%d", port_ids[j]) {
+ char *name;
+
+ name = chamelium_get_port_name_rpc(chamelium, port_ids[j]);
+ igt_info("Testing port %s\n", name);
+ free(name);
+
+ edid_mst(drm_fd, chamelium, port_ids[j]);
+ }
+ }
+ }
+ }
igt_fixture {
chamelium_rpc_uninit(chamelium);
drm_close_driver(drm_fd);
--
2.43.2
More information about the igt-dev
mailing list