From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Daniel Vetter <daniel@ffwll.ch>
Subject: [igt-dev] [PATCH i-g-t] tests/kms_chamelium: add a hotplug test with active connector
Date: Wed, 14 Aug 2019 18:18:49 +0300 [thread overview]
Message-ID: <20190814151849.10060-1-simon.ser@intel.com> (raw)
This test enables a connector, unplugs it, re-plugs it, and makes sure the
Chamelium board still receives a video signal.
Legacy userspace doesn't necessarily handle hotplug uevents. This test makes
sure we don't break it.
See [1] and [2] for more context.
[1]: https://lists.freedesktop.org/archives/igt-dev/2019-July/015071.html
[2]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
Signed-off-by: Simon Ser <simon.ser@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Imre Deak <imre.deak@intel.com>
---
We should probably skip this test on DP-MST and USB-C?
tests/kms_chamelium.c | 84 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index f25d13c6e7c3..5cb9a3b9b363 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -862,6 +862,80 @@ static void test_mode_timings(data_t *data, struct chamelium_port *port)
drmModeFreeConnector(connector);
}
+#define WAIT_VIDEO_INPUT_STABLE_TIMEOUT 5 /* seconds */
+
+/** test_hotplug_while_active:
+ *
+ * Plug a connector, enable it, unplug it, re-plug it and check we still have a
+ * stable input signal.
+ *
+ * Legacy userspace that doesn't consume hotplug events rely on this behaviour.
+ */
+static void
+test_hotplug_while_active(data_t *data, struct chamelium_port *port)
+{
+ struct udev_monitor *mon = igt_watch_hotplug();
+ igt_output_t *output;
+ drmModeConnector *connector;
+ igt_plane_t *primary;
+ struct igt_fb fb;
+ drmModeModeInfo *mode;
+ unsigned int fb_id;
+ bool ok;
+
+ reset_state(data, port);
+
+ igt_flush_hotplugs(mon);
+
+ chamelium_plug(data->chamelium, port);
+ igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+ igt_assert_eq(reprobe_connector(data, port), DRM_MODE_CONNECTED);
+
+ output = prepare_output(data, port, TEST_EDID_BASE);
+ connector = chamelium_port_get_connector(data->chamelium, port, false);
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ igt_assert(primary);
+
+ igt_assert(connector->count_modes > 0);
+ mode = &connector->modes[0];
+
+ fb_id = igt_create_color_pattern_fb(data->drm_fd,
+ mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_DRM_FORMAT_MOD_NONE,
+ 0, 0, 0, &fb);
+ igt_assert(fb_id > 0);
+
+ enable_output(data, port, output, mode, &fb);
+
+ ok = chamelium_port_wait_video_input_stable(data->chamelium, port,
+ WAIT_VIDEO_INPUT_STABLE_TIMEOUT);
+ igt_assert_f(ok, "Failed to wait for video input to become stable "
+ "after hotplug\n");
+
+ igt_flush_hotplugs(mon);
+
+ /* Unplug and re-plug the connector without disabling the output. */
+ chamelium_unplug(data->chamelium, port);
+ igt_assert_f(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT),
+ "Expected hotplug event after unplug\n");
+ igt_assert_eq(reprobe_connector(data, port), DRM_MODE_DISCONNECTED);
+
+ igt_flush_hotplugs(mon);
+
+ chamelium_plug(data->chamelium, port);
+ igt_assert_f(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT),
+ "Expected hotplug event after unplug-replug sequence\n");
+ igt_assert_eq(reprobe_connector(data, port), DRM_MODE_CONNECTED);
+
+ ok = chamelium_port_wait_video_input_stable(data->chamelium, port,
+ WAIT_VIDEO_INPUT_STABLE_TIMEOUT);
+ igt_assert_f(ok, "Failed to wait for video input to become stable "
+ "after unplug and re-plug\n");
+
+ igt_cleanup_hotplug(mon);
+}
+
/* Playback parameters control the audio signal we synthesize and send */
#define PLAYBACK_CHANNELS 2
@@ -2267,6 +2341,9 @@ igt_main
test_basic_hotplug(&data, port,
HPD_TOGGLE_COUNT_FAST);
+ connector_subtest("dp-hpd-active", DisplayPort)
+ test_hotplug_while_active(&data, port);
+
connector_subtest("dp-edid-read", DisplayPort) {
test_edid_read(&data, port, TEST_EDID_BASE);
test_edid_read(&data, port, TEST_EDID_ALT);
@@ -2345,6 +2422,9 @@ igt_main
test_basic_hotplug(&data, port,
HPD_TOGGLE_COUNT_FAST);
+ connector_subtest("hdmi-hpd-active", HDMIA)
+ test_hotplug_while_active(&data, port);
+
connector_subtest("hdmi-edid-read", HDMIA) {
test_edid_read(&data, port, TEST_EDID_BASE);
test_edid_read(&data, port, TEST_EDID_ALT);
@@ -2501,6 +2581,10 @@ igt_main
connector_subtest("vga-hpd-fast", VGA)
test_basic_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST);
+ connector_subtest("vga-hpd-active", VGA)
+ test_hotplug_while_active(&data, port);
+
+
connector_subtest("vga-edid-read", VGA) {
test_edid_read(&data, port, TEST_EDID_BASE);
test_edid_read(&data, port, TEST_EDID_ALT);
--
2.22.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-08-14 15:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-14 15:18 Simon Ser [this message]
2019-08-14 16:09 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/kms_chamelium: add a hotplug test with active connector Patchwork
2019-08-14 16:14 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-08-15 7:46 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-08-16 9:23 ` [igt-dev] [PATCH i-g-t] " Imre Deak
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=20190814151849.10060-1-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=daniel@ffwll.ch \
--cc=igt-dev@lists.freedesktop.org \
/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