[PATCH i-g-t v2 38/39] tests/chamelium/v3: Add MST EDID reading test
Louis Chauvet
louis.chauvet at bootlin.com
Tue Jul 9 15:34:54 UTC 2024
This commit introduces a new test for the Chameleon V3 display adapter to
ensure that EDID is correctly read from MST ports.
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
tests/chamelium/v3/kms_chamelium_v3_edid.c | 86 ++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/tests/chamelium/v3/kms_chamelium_v3_edid.c b/tests/chamelium/v3/kms_chamelium_v3_edid.c
index a73875214915..51dcdcb9e892 100644
--- a/tests/chamelium/v3/kms_chamelium_v3_edid.c
+++ b/tests/chamelium/v3/kms_chamelium_v3_edid.c
@@ -190,6 +190,70 @@ static void test_suspend_resume_edid_change(int drm_fd, struct igt_chamelium_v3
collect_and_compare_edid(drm_fd, port_mapping, igt_kms_get_alt_edid());
}
+static void edid_mst(int drm_fd, struct igt_chamelium_v3 *chamelium, chamelium_v3_port_id port_id)
+{
+ const struct edid *edid = igt_kms_get_base_edid();
+ chamelium_v3_port_id *children_port_ids;
+ struct chamelium_v3_port_mapping *chamelium_port_mapping;
+ drmModeResPtr res;
+ int edid_id;
+ int children_port_count = chamelium_v3_get_children(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_v3_reset(chamelium);
+
+ edid_id = chamelium_v3_create_edid(chamelium, modified_edids[0]);
+ igt_assert(edid_id);
+ chamelium_v3_apply_edid(chamelium, port_id, edid_id);
+
+ for (int i = 0; i < children_port_count; i++) {
+ edid_id = chamelium_v3_create_edid(chamelium, modified_edids[i + 1]);
+ igt_assert(edid_id);
+ chamelium_v3_apply_edid(chamelium, children_port_ids[i], edid_id);
+ }
+
+ chamelium_v3_plug_with_children(chamelium, port_id, children_port_ids,
+ children_port_count);
+ sleep(3);
+
+ res = drmModeGetResources(drm_fd);
+
+ chamelium_port_mapping = chamelium_v3_get_port_mapping_for_chamelium_port_id(chamelium,
+ port_id);
+ igt_assert(chamelium_port_mapping);
+ igt_assert(chamelium_port_mapping->mst_path);
+ collect_and_compare_edid(drm_fd, chamelium_port_mapping, modified_edids[0]);
+ free(modified_edids[0]);
+
+ for (int i = 0; i < children_port_count; i++) {
+ chamelium_port_mapping = chamelium_v3_get_port_mapping_for_chamelium_port_id(chamelium,
+ children_port_ids[i]);
+ igt_assert(chamelium_port_mapping);
+ igt_assert(chamelium_port_mapping->mst_path);
+ collect_and_compare_edid(drm_fd, chamelium_port_mapping, modified_edids[i + 1]);
+ free(modified_edids[i + 1]);
+ }
+
+ drmModeFreeResources(res);
+ free(modified_edids);
+ free(children_port_ids);
+}
+
igt_main
{
struct igt_chamelium_v3 *chamelium;
@@ -326,6 +390,28 @@ igt_main
}
}
+ igt_describe("Check if hotplug during sleeping are correctly handled");
+ igt_subtest_with_dynamic("DP-MST-edid-read") {
+ chamelium_v3_port_id *port_ids;
+ int port_count;
+
+ port_count = chamelium_v3_get_supported_ports(chamelium, &port_ids);
+ for (int j = 0; j < port_count; j++) {
+ igt_dynamic_f("port-%d", port_ids[j]) {
+ char *name;
+
+ igt_require(chamelium_v3_is_mst(chamelium, port_ids[j]));
+
+ name = chamelium_v3_get_port_name(chamelium, port_ids[j]);
+ igt_info("Testing port %s\n", name);
+ free(name);
+
+ edid_mst(drm_fd, chamelium, port_ids[j]);
+ }
+ }
+ free(port_ids);
+ }
+
igt_fixture {
chamelium_v3_uninit(chamelium);
drm_close_driver(drm_fd);
--
2.44.2
More information about the igt-dev
mailing list