[PATCH i-g-t] lib/igt_kms: Update igt_fit_modes_in_bw to add legacy commit check

Peter Senna Tschudin peter.senna at linux.intel.com
Fri Jul 11 07:50:32 UTC 2025


Hi Karthik,

On 7/10/2025 9:46 PM, Karthik B S wrote:
> Currently igt_fit_modes_in_bw is only checking for atomic commit but the
> igt_override_all_active_output_modes_to_fit_bw function which it is
> wrapping actually has support for legacy commit as well.
> 
> To handle this, add support for legacy commit check as well.
> 
> Signed-off-by: Karthik B S <karthik.b.s at intel.com>
> ---
>  lib/igt_kms.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 84ba1635c..7dee8ab2c 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5061,9 +5061,13 @@ bool igt_fit_modes_in_bw(igt_display_t *display)
>  {
>  	int ret;
>  
> -	ret = igt_display_try_commit_atomic(display,
> -					    DRM_MODE_ATOMIC_TEST_ONLY |
> -					    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> +	if (display->is_atomic)
> +		ret = igt_display_try_commit_atomic(display,
> +						    DRM_MODE_ATOMIC_TEST_ONLY |
> +						    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> +	else
> +		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
> +
>  	if (ret != 0) {
>  		bool found;
>  

I guess the function description needs attention. Currently it is "Tries
atomic TEST_ONLY commit; if it fails, overrides output modes to fit
bandwidth."

Now that it also tries the COMMIT_LEGACY, what about:

"Attempts to commit the current display configuration. For atomic
displays, performs an atomic TEST_ONLY commit; for legacy non-atomic
displays, performs a legacy commit. If the commit fails, attempts to
override all active output modes to fit within available bandwidth."

Reviewed-by: Peter Senna Tschudin <peter.senna at linux.intel.com>


More information about the igt-dev mailing list