[igt-dev] [v4 i-g-t 02/14] tests/kms_frontbuffer_tracking: Fix mode selection for 2x tests

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Fri May 7 12:46:15 UTC 2021


On 5/4/2021 6:13 AM, Bhanuprakash Modem wrote:
> When two monitors connected through MST, the second monitor also
> tries to use the same mode. So two such modes may not fit into the
> link bandwidth.
>
> This patch will find a combination of modes that fit into the BW.
>
> V2:
> * Remove MST specific logic (Daniel)
>
> Cc: Imre Deak <imre.deak at intel.com>
> Cc: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> ---
>   tests/kms_frontbuffer_tracking.c | 33 ++++++++++++++++++++++++++++++++
>   1 file changed, 33 insertions(+)
>
> diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
> index 2e74bec6f..211a5f3f8 100644
> --- a/tests/kms_frontbuffer_tracking.c
> +++ b/tests/kms_frontbuffer_tracking.c
> @@ -1683,6 +1683,33 @@ static void enable_prim_screen_and_wait(const struct test_mode *t)
>   	do_assertions(ASSERT_NO_ACTION_CHANGE);
>   }
>   
> +static void update_modeset_cached_params(void)
> +{
> +	bool found = false;
> +
> +	igt_output_set_pipe(prim_mode_params.output, prim_mode_params.pipe);
> +	igt_output_set_pipe(scnd_mode_params.output, scnd_mode_params.pipe);
> +
> +	found = igt_override_all_active_output_modes_to_fit_link_bw(&drm.display);
> +	igt_require_f(found, "No valid mode combo found.\n");
> +
> +	prim_mode_params.mode_copy = *igt_output_get_mode(prim_mode_params.output);
> +	prim_mode_params.mode = &prim_mode_params.mode_copy;
> +	prim_mode_params.primary.w = prim_mode_params.mode->hdisplay;
> +	prim_mode_params.primary.h = prim_mode_params.mode->vdisplay;
> +
> +	scnd_mode_params.mode_copy = *igt_output_get_mode(scnd_mode_params.output);
> +	scnd_mode_params.mode = &scnd_mode_params.mode_copy;
> +	scnd_mode_params.primary.w = scnd_mode_params.mode->hdisplay;
> +	scnd_mode_params.primary.h = scnd_mode_params.mode->vdisplay;
> +
> +	fill_fb_region(&prim_mode_params.primary, COLOR_PRIM_BG);
> +	fill_fb_region(&scnd_mode_params.primary, COLOR_SCND_BG);
> +
> +	__set_mode_for_params(&prim_mode_params);
> +	__set_mode_for_params(&scnd_mode_params);
> +}
> +
>   static void enable_both_screens_and_wait(const struct test_mode *t)
>   {
>   	fill_fb_region(&prim_mode_params.primary, COLOR_PRIM_BG);
> @@ -1691,6 +1718,12 @@ static void enable_both_screens_and_wait(const struct test_mode *t)
>   	__set_mode_for_params(&prim_mode_params);
>   	__set_mode_for_params(&scnd_mode_params);
>   
> +	if (igt_display_try_commit_atomic(&drm.display,
> +					  DRM_MODE_ATOMIC_TEST_ONLY |
> +					  DRM_MODE_ATOMIC_ALLOW_MODESET,
> +					  NULL) != 0)
> +		update_modeset_cached_params();
> +
>   	igt_display_commit2(&drm.display, drm.display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);

As suggested in previous patch, for legacy commit case we need to modify 
the  igt_override_all_active_output_modes_to_fit_link_bw(), and use 
try_commit2() calls.

Or else if we want to try combination of modes only for atomic commit, 
then we need to skip this for legacy commit.


Regards,

Ankit

>   
>   	wanted_crc = &blue_crcs[t->format].crc;


More information about the igt-dev mailing list