[PATCH i-g-t] tests/kms_setmode: Find compatible mode for eDP before selecting default mode

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Jul 14 11:51:25 UTC 2025


Hi Jeevan,
On 2025-06-13 at 11:18:48 +0530, Jeevan B wrote:
> This change finds a common mode for eDP before falling back to default mode.
> It avoids unnecessary failures by not selecting an unsupported mode for eDP.
> 
> Signed-off-by: Jeevan B <jeevan.b at intel.com>
> ---
>  tests/kms_setmode.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
> index 484c3a95f..6e7e5942a 100644
> --- a/tests/kms_setmode.c
> +++ b/tests/kms_setmode.c
> @@ -252,6 +252,21 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
>  			goto found;
>  	}
>  
> +	/*
> +	 * If eDP is present, try its modes to find a compatible one.
> +	 */
> +	for (int c = 0; c < crtc->connector_count; c++) {
> +		drmModeConnector *conn = crtc->cconfs[c].connector;

Add newline here.

> +		if (conn->connector_type == DRM_MODE_CONNECTOR_eDP) {
> +			for (i = 0; i < conn->count_modes; i++) {
> +				mode = &conn->modes[i];
> +				if (crtc_supports_mode(crtc, mode))
> +					goto found;

This looks ok, adding Swati and Karthik to cc.

Regards,
Kamil

> +			}
> +		break;
> +		}
> +	}
> +
>  	/*
>  	 * If none is found then just pick the default mode from all connectors
>  	 * with the smallest clock, hope the other connectors can support it by
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list