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

Reddy Guddati, Santhosh
2026-02-26T11:20:03Z

On 26-02-2026 14:18, Ville Syrjälä wrote:
> 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?

Please refer to below gitlab issue which occurs very sporadically
(Closed now)
https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/7043

I agree this igt_output_get_mode() doesn't return an invalid mode but in
the failure logs, fb creation is done with width=0, height=0 , so as a
defensive checck, this is added to validate here rather asserting in
xe_bo_create.

It is not specific to kms_async_flips, but it just exposed in this test
path.

Thanks,
Santhosh

>
>> + 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
>