[i-g-t V6 06/10] tests/kms_vrr: Add a helper to get the low refresh mode

Golani, Mitulkumar Ajitkumar mitulkumar.ajitkumar.golani at intel.com
Thu Dec 7 14:42:39 UTC 2023



> -----Original Message-----
> From: Modem, Bhanuprakash <bhanuprakash.modem at intel.com>
> Sent: Thursday, December 7, 2023 12:19 PM
> To: igt-dev at lists.freedesktop.org; ville.syrjala at linux.intel.com; Golani,
> Mitulkumar Ajitkumar <mitulkumar.ajitkumar.golani at intel.com>
> Cc: Modem, Bhanuprakash <bhanuprakash.modem at intel.com>
> Subject: [i-g-t V6 06/10] tests/kms_vrr: Add a helper to get the low refresh
> mode
> 
> To switch the refresh rate seamlessly, add a new helper to identify the mode
> with the same resolution but low vrefresh and clock.
> 
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> ---
>  tests/kms_vrr.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c index db82cd008..f3cd18dcd
> 100644
> --- a/tests/kms_vrr.c
> +++ b/tests/kms_vrr.c
> @@ -166,6 +166,24 @@ output_mode_with_maxrate(igt_output_t *output,
> unsigned int vrr_max)
>  	return mode;
>  }
> 
> +static drmModeModeInfo
> +low_rr_mode_with_same_res(igt_output_t *output, unsigned int vrr_min) {
> +	int i;
> +	drmModeConnectorPtr connector = output->config.connector;
> +	drmModeModeInfo mode = *igt_output_get_mode(output);
> +
> +	for (i = 0; i < connector->count_modes; i++)
> +		if (connector->modes[i].hdisplay == mode.hdisplay &&
> +		    connector->modes[i].vdisplay == mode.vdisplay &&
> +		    connector->modes[i].clock < mode.clock &&
> +		    connector->modes[i].vrefresh < mode.vrefresh &&
> +		    connector->modes[i].vrefresh >= vrr_min)
> +			mode = connector->modes[i];
> +
> +	return mode;
> +}
> +
Please add this function in the patch where it is being called.

- Mitul

>  /* Read min and max vrr range from the connector debugfs. */  static
> range_t  get_vrr_range(data_t *data, igt_output_t *output)
> --
> 2.40.0



More information about the igt-dev mailing list