[igt-dev] [RFC PATCH] tests/kms_async_flips: add atomic test
André Almeida
andrealmeid at igalia.com
Fri Oct 28 21:30:41 UTC 2022
Hi Simon,
On 8/24/22 11:58, Simon Ser wrote:
> This adds a simple test for DRM_MODE_PAGE_FLIP_ASYNC with the
> atomic uAPI.
>
I extended your test as required by Ville. Feel free to concatenated it
and to add my SoB tag.
--- >8 ---
From d990d57468458a7ffccf90bee664ffa0dc69140e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Almeida?= <andrealmeid at igalia.com>
Date: Fri, 28 Oct 2022 18:18:02 -0300
Subject: [PATCH] tests/kms_async_flips: Add test for invalid changes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
DRM atomic API should reject any changes during an async flip, so test
if the kernel properly rejects it.
Signed-off-by: André Almeida <andrealmeid at igalia.com>
---
tests/kms_async_flips.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 7173ca65..cfca2674 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -287,6 +287,38 @@ static void test_async_flip_atomic(data_t *data)
"FPS should be significantly higher than the refresh rate\n");
}
+static void test_invalid_atomic(data_t *data)
+{
+ int flags = DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT;
+ drmModeConnector *connector = output->config.connector;
+ igt_output_t *output = data->output;
+ int ret;
+
+ test_init(data);
+
+ /* Trying to change plane position */
+ igt_plane_set_position(data->plane, 15, 15);
+ igt_plane_set_fb(data->plane, &data->bufs[1]);
+ ret = igt_display_try_commit_atomic(&data->display, flags, data);
+ igt_assert(ret == -EINVAL);
+ igt_plane_set_position(data->plane, 0, 0);
+
+ /* Trying to change plane rotation */
+ igt_plane_set_rotation(data->plane, IGT_ROTATION_180);
+ igt_plane_set_fb(data->plane, &data->bufs[1]);
+ ret = igt_display_try_commit_atomic(&data->display, flags, data);
+ igt_assert(ret == -EINVAL);
+ igt_plane_set_rotation(data->plane, IGT_ROTATION_0);
+
+ /* Trying to change mode */
+ for_each_connector_mode(output) {
+ igt_output_override_mode(output, &connector->modes[j__]);
+ ret = igt_display_try_commit_atomic(&data->display, flags, data);
+ igt_assert(ret == -EINVAL);
+ }
+ igt_output_override_mode(output, NULL);
+}
+
static void wait_for_vblank(data_t *data, unsigned long *vbl_time,
unsigned int *seq)
{
drmVBlank wait_vbl;
@@ -680,6 +712,14 @@ igt_main_args("e", NULL, help_str, opt_handler, &data)
run_test(&data, test_async_flip_atomic);
}
+ igt_describe("Negative case to verify if any atomic changes are
rejected from kernel as expected");
+ igt_subtest_with_dynamic("invalid-atomic-async-flip") {
+ require_monotonic_timestamp(data.drm_fd);
+ igt_require_f(igt_has_drm_cap(data.drm_fd,
DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP),
+ "Atomic async page-flips are not supported\n");
+ run_test(&data, test_invalid_atomic);
+ }
+
igt_fixture {
for (i = 0; i < ARRAY_SIZE(data.bufs); i++)
igt_remove_fb(data.drm_fd, &data.bufs[i]);
--
2.37.3
More information about the igt-dev
mailing list