From: Louis Chauvet <louis.chauvet@bootlin.com>
To: igt-dev@lists.freedesktop.org, ihf@google.com,
markyacoub@google.com, thomas.petazzoni@bootlin.com,
Louis Chauvet <louis.chauvet@bootlin.com>
Subject: [PATCH i-g-t RFC 07/13] tests/chamelium: Introduce basic edid test
Date: Wed, 05 Jun 2024 16:30:19 +0200 [thread overview]
Message-ID: <20240605-dev-remove-static-ports-v1-7-665f25b7a4db@bootlin.com> (raw)
In-Reply-To: <20240605-dev-remove-static-ports-v1-0-665f25b7a4db@bootlin.com>
This commit adds a new Chamelium v3 test that verifies the correct
handling of EDID data. The test uploads a custom EDID to the Chamelium and
then verifies that the EDID data can be read back from the kernel.
This test is inspired from the v2 version.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
tests/chamelium/v3/kms_chamelium_v3_edid.c | 93 ++++++++++++++++++++++++++++++
tests/meson.build | 1 +
2 files changed, 94 insertions(+)
diff --git a/tests/chamelium/v3/kms_chamelium_v3_edid.c b/tests/chamelium/v3/kms_chamelium_v3_edid.c
new file mode 100644
index 000000000000..acf62ba78a32
--- /dev/null
+++ b/tests/chamelium/v3/kms_chamelium_v3_edid.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: MIT
+
+#include <igt.h>
+#include "chamelium/v3/igt_chamelium.h"
+
+static void collect_and_compare_edid(int drm_fd,
+ const struct chamelium_rpc_port_mapping *port_mapping,
+ const struct edid *edid)
+{
+ drmModePropertyBlobPtr edid_blob = NULL;
+ drmModeConnector *connector;
+ uint64_t edid_blob_id;
+
+ connector = chamelium_rpc_port_mapping_get_connector(port_mapping, drm_fd);
+ igt_assert(kmstest_get_property(drm_fd, connector->connector_id,
+ DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
+ &edid_blob_id, NULL));
+ igt_assert(edid_blob_id != 0);
+ edid_blob = drmModeGetPropertyBlob(drm_fd, edid_blob_id);
+ igt_assert(edid_blob);
+
+ igt_assert(memcmp(edid, edid_blob->data, edid_get_size(edid)) == 0);
+
+ drmModeFreePropertyBlob(edid_blob);
+ drmModeFreeConnector(connector);
+}
+
+static void upload_and_read_edid(int drm_fd, struct igt_chamelium_rpc *chamelium,
+ const struct chamelium_rpc_port_mapping *port_mapping,
+ const struct edid *edid)
+{
+ drmModePropertyBlobPtr edid_blob = NULL;
+ drmModeConnector *connector;
+ uint64_t edid_blob_id;
+ int edid_id;
+
+ chamelium_reset_rpc(chamelium);
+ edid_id = chamelium_create_edid_rpc(chamelium, edid);
+ chamelium_apply_edid_rpc(chamelium, port_mapping->port_id, edid_id);
+ chamelium_plug_rpc(chamelium, port_mapping->port_id);
+
+ connector = chamelium_rpc_port_mapping_get_connector(port_mapping, drm_fd);
+ assert(igt_wait_for_connector_status(drm_fd, connector->connector_id, 10.0,
+ DRM_MODE_CONNECTED));
+ drmModeFreeConnector(connector);
+
+ collect_and_compare_edid(drm_fd, port_mapping, edid);
+}
+
+static void igt_custom_edid_type_read(int drm_fd, struct igt_chamelium_rpc *chamelium,
+ struct chamelium_rpc_port_mapping *port_mapping,
+ enum igt_custom_edid_type edid)
+{
+ upload_and_read_edid(drm_fd, chamelium, port_mapping, igt_kms_get_custom_edid(edid));
+}
+
+igt_main {
+ struct igt_chamelium_rpc *chamelium;
+ int drm_fd;
+
+ igt_fixture {
+ chamelium = chamelium_rpc_init_from_config();
+ igt_assert(chamelium);
+ drm_fd = drm_open_driver_master(DRIVER_ANY);
+ igt_assert(drm_fd);
+ chamelium_rpc_fill_port_mapping(chamelium, drm_fd);
+ }
+
+ igt_describe("Read basic EDID from the chamelium.");
+ igt_subtest_with_dynamic("edid-read-basic") {
+ struct chamelium_rpc_port_mapping *port, *tmp;
+
+ igt_list_for_each_entry_safe(port, tmp, chamelium_rpc_get_port_mapping(chamelium),
+ link) {
+ igt_dynamic_f("port-%d", port->port_id) {
+ char *name;
+
+ name = chamelium_get_port_name_rpc(chamelium, port->port_id);
+ igt_info("Testing port %s (%s)\n", port->connector_name, name);
+ free(name);
+ igt_custom_edid_type_read(drm_fd, chamelium, port,
+ IGT_CUSTOM_EDID_BASE);
+ igt_custom_edid_type_read(drm_fd, chamelium, port,
+ IGT_CUSTOM_EDID_ALT);
+ }
+ }
+ }
+
+ igt_fixture {
+ chamelium_rpc_uninit(chamelium);
+ drm_close_driver(drm_fd);
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index 51396548eec9..c37180eb3d3d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -336,6 +336,7 @@ chamelium_v2_progs = [
chamelium_v3_progs = [
'kms_chamelium_v3_basic',
+ 'kms_chamelium_v3_edid',
]
test_deps = [ igt_deps ]
--
2.43.2
next prev parent reply other threads:[~2024-06-05 14:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 14:30 [PATCH i-g-t RFC 00/13] tests/chamelium: Integrate the chamelium v3 Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 01/13] tests/chamelium: Extract chamelium v2 tests into its own directory Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 02/13] lib/chamelium: Extract chamelium v2 wrapper " Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 03/13] lib/chamelium: Change build options to split chamelium v2 and v3 Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 04/13] lib/chamelium: Introduce the foundation for the chamelium v3 library Louis Chauvet
2024-06-11 16:45 ` Kamil Konieczny
2024-06-05 14:30 ` [PATCH i-g-t RFC 05/13] lib/chamelium: Implement all RPC calls for the chamelium v3 Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 06/13] lib/chamelium: Introduce a simple chamelium v3 test Louis Chauvet
2024-06-05 14:30 ` Louis Chauvet [this message]
2024-06-05 14:30 ` [PATCH i-g-t RFC 08/13] lib/monitor_edids: Introduce helpers to get EDID from a monitor EDID Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 09/13] tests/chamelium: Introduce 4k stress edid Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 10/13] tests/chamelium: Introduce non-4k " Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 11/13] tests/chamelium: Introduce test resolution Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 12/13] tests/chamelium: Introduce test sleep Louis Chauvet
2024-06-05 14:30 ` [PATCH i-g-t RFC 13/13] tests/chamelium: Add MST test Louis Chauvet
2024-06-05 16:36 ` ✗ Fi.CI.BUILD: failure for tests/chamelium: Integrate the chamelium v3 Patchwork
2024-06-07 19:05 ` ✗ GitLab.Pipeline: warning " Patchwork
2024-06-11 16:51 ` [PATCH i-g-t RFC 00/13] " Kamil Konieczny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240605-dev-remove-static-ports-v1-7-665f25b7a4db@bootlin.com \
--to=louis.chauvet@bootlin.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=ihf@google.com \
--cc=markyacoub@google.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox