Re: [PATCH i-g-t v1] tests/kms_async_flips: validate mode before proceeding with fb creation

Ville Syrjälä
2026-02-26T08:49:14Z

On Wed, Feb 25, 2026 at 04:35:10PM +0530, Santhosh Reddy Guddati wrote:
> Validate mode before proceeding with creating frame buffers to avoid
> passing invalid parameters to the ioctl.
>
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
> ---
> tests/kms_async_flips.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index 014b7f347..d00b36544 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -298,6 +298,12 @@ static void test_init(data_t *data)
> igt_display_commit(&data->display);
>
> mode = igt_output_get_mode(data->output);

How would that even return some kind of invalid mode?
And why would it be a problem only for kms_async_flips?

> + igt_require_f(kmstest_mode_is_valid(mode),
> + "Invalid mode on %s (%dx%d@%d)",
> + data->output->name,
> + mode ? mode->hdisplay : 0,
> + mode ? mode->vdisplay : 0,
> + mode ? mode->vrefresh : 0);
>
> data->crtc_id = data->crtc->crtc_id;
> data->refresh_rate = mode->vrefresh;
> @@ -327,6 +333,12 @@ static void test_init_fbs(data_t *data)
> drmModeModeInfo *mode;
>
> mode = igt_output_get_mode(data->output);
> + igt_require_f(kmstest_mode_is_valid(mode),
> + "Invalid mode on %s (%dx%d@%d)",
> + data->output->name,
> + mode ? mode->hdisplay : 0,
> + mode ? mode->vdisplay : 0,
> + mode ? mode->vrefresh : 0);
> width = mode->hdisplay;
> height = mode->vdisplay;
>
> @@ -672,6 +684,12 @@ static void test_invalid(data_t *data)
> igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
>
> mode = igt_output_get_mode(data->output);
> + igt_require_f(kmstest_mode_is_valid(mode),
> + "Invalid mode on %s (%dx%d@%d)",
> + data->output->name,
> + mode ? mode->hdisplay : 0,
> + mode ? mode->vdisplay : 0,
> + mode ? mode->vrefresh : 0);
> width = mode->hdisplay;
> height = mode->vdisplay;
>
> --
> 2.34.1

--
Ville Syrjälä
Intel