[PATCH i-g-t 2/3] tests/kms_async_flips: Add hang subtest
B, Jeevan
jeevan.b at intel.com
Tue Jun 24 05:46:00 UTC 2025
> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Karthik B
> S
> Sent: Thursday, June 19, 2025 4:54 PM
> To: igt-dev at lists.freedesktop.org
> Cc: Reddy Guddati, Santhosh <santhosh.reddy.guddati at intel.com>; Murthy,
> Arun R <arun.r.murthy at intel.com>; B S, Karthik <karthik.b.s at intel.com>
> Subject: [PATCH i-g-t 2/3] tests/kms_async_flips: Add hang subtest
>
> Test functionality of async flips with hang.
>
> Signed-off-by: Karthik B S <karthik.b.s at intel.com>
> ---
> tests/kms_async_flips.c | 37 ++++++++++++++++++++++++++++++++++---
> 1 file changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c index
> 0f2d932e4..8587e4675 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -86,6 +86,9 @@
> * SUBTEST: async-flip-suspend-resume
> * Description: Verify the async flip functionality with suspend and resume
> cycle
> *
> + * SUBTEST: async-flip-hang
> + * Description: Verify the async flip functionality with hang cycle
> + *
> * SUBTEST: overlay-atomic
> * Description: Verify overlay planes with async flips in atomic API
> *
> @@ -132,6 +135,7 @@ typedef struct {
> enum pipe pipe;
> bool alternate_sync_async;
> bool suspend_resume;
> + bool hang;
> bool allow_fail;
> struct buf_ops *bops;
> bool atomic_path;
> @@ -376,8 +380,10 @@ static void test_async_flip(data_t *data)
> int ret, frame;
> long long int fps;
> struct timeval start, end, diff;
> - int suspend_time = RUN_TIME / 2;
> - bool temp = data->suspend_resume;
> + igt_hang_t hang;
> + uint64_t ahnd = 0;
> + int mid_time = RUN_TIME / 2;
> + bool temp = data->suspend_resume || data->hang;
>
> igt_display_commit2(&data->display, data->display.is_atomic ?
> COMMIT_ATOMIC : COMMIT_LEGACY);
>
> @@ -433,13 +439,29 @@ static void test_async_flip(data_t *data)
> data->flip_interval, data->refresh_rate,
> MIN_FLIPS_PER_FRAME);
> }
>
> - if (data->suspend_resume && diff.tv_sec == suspend_time &&
> temp) {
> + if (data->suspend_resume && diff.tv_sec == mid_time &&
> temp) {
> temp = false;
>
> igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> SUSPEND_TEST_NONE);
>
Can we add a comment line describing what we are doing here.
/* Trigger a GPU hang at mid-point to test async flip recovery */
With this minor suggestion patch LGTM.
Reviewed-by: Jeevan B <jeevan.b at intel.com>
> +
> + if (data->hang && diff.tv_sec == mid_time && temp) {
> + temp = false;
> + memset(&hang, 0, sizeof(hang));
> +
> + ahnd = is_i915_device(data->drm_fd) ?
> + get_reloc_ahnd(data->drm_fd, 0) :
> + intel_allocator_open(data->drm_fd, 0,
> INTEL_ALLOCATOR_RELOC);
> + hang = igt_hang_ring_with_ahnd(data->drm_fd,
> I915_EXEC_DEFAULT, ahnd);
> + }
> +
> frame++;
> } while (diff.tv_sec < RUN_TIME);
>
> + if (data->hang) {
> + igt_post_hang_ring(data->drm_fd, hang);
> + put_ahnd(ahnd);
> + }
> +
> if (!data->alternate_sync_async) {
> fps = frame * 1000 / RUN_TIME;
> igt_assert_f((fps / 1000) > (data->refresh_rate *
> MIN_FLIPS_PER_FRAME), @@ -1032,6 +1054,15 @@ igt_main
> data.suspend_resume = false;
> }
>
> + igt_describe("Verify the async flip functionality after hang cycle");
> + igt_subtest_with_dynamic("async-flip-hang") {
> + igt_require(is_intel_device(data.drm_fd));
> + test_init_ops(&data);
> + data.hang = true;
> + run_test(&data, test_async_flip);
> + data.hang = false;
> + }
> +
> igt_fixture {
> for (i = 0; i < NUM_FBS; i++) {
> igt_remove_fb(data.drm_fd, &data.bufs[i]);
> --
> 2.43.0
More information about the igt-dev
mailing list