[igt-dev] [PATCH i-g-t 1/3] tests/kms_plane_lowres: Search for modes of the connector being tested

Kahola, Mika mika.kahola at intel.com
Mon Apr 1 13:10:27 UTC 2019


I'm in favor to add this check to the test.


On Fri, 2019-03-29 at 18:03 -0700, José Roberto de Souza wrote:
> get_lowres_mode() was looking for the desired mode over all
> connectors what could cause commit to fail due incompatibility.
> 
> Cc: Mika Kahola <mika.kahola at intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
Reviewed-by: Mika Kahola <mika.kahola at intel.com>

> ---
>  tests/kms_plane_lowres.c | 48 +++++++++-----------------------------
> --
>  1 file changed, 11 insertions(+), 37 deletions(-)
> 
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index b27e5e61..f7739b11 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -43,9 +43,8 @@ typedef struct {
>  } data_t;
>  
>  static drmModeModeInfo
> -get_lowres_mode(int drmfd, drmModeModeInfo *mode_default)
> +get_lowres_mode(int drmfd, igt_output_t *output, drmModeModeInfo
> *mode_default)
>  {
> -	drmModeRes *mode_resources = drmModeGetResources(drmfd);
>  	drmModeModeInfo mode;
>  	drmModeModeInfo std_1024_mode = {
>  		.clock = 65000,
> @@ -64,43 +63,18 @@ get_lowres_mode(int drmfd, drmModeModeInfo
> *mode_default)
>  		.type = 0x40,
>  		.name = "Custom 1024x768",
>  	};
> -	bool found;
> -	int limit = mode_default->vdisplay-SIZE;
> -	int i, j;
> -
> -	if (!mode_resources) {
> -		igt_warn("drmModeGetResources failed: %s\n",
> strerror(errno));
> -		return std_1024_mode;
> -	}
> -
> -	found = false;
> -	for (i = 0; i < mode_resources->count_connectors; i++) {
> -		drmModeConnector *connector;
> -
> -		connector = drmModeGetConnectorCurrent(drmfd,
> -						       mode_resources-
> >connectors[i]);
> -		if (!connector) {
> -			igt_warn("could not get connector %i: %s\n",
> -				 mode_resources->connectors[i],
> strerror(errno));
> -			continue;
> +	bool found = false;
> +	int limit = mode_default->vdisplay - SIZE;
> +	int j;
> +
> +	for (j = 0; j < output->config.connector->count_modes; j++) {
> +		mode = output->config.connector->modes[j];
> +		if (mode.vdisplay < limit) {
> +			found = true;
> +			break;
>  		}
> -
> -		if (!connector->count_modes)
> -			continue;
> -
> -		for (j = 0; j < connector->count_modes; j++) {
> -			mode = connector->modes[j];
> -			if (mode.vdisplay < limit) {
> -				found = true;
> -				break;
> -			}
> -		}
> -
> -		drmModeFreeConnector(connector);
>  	}
>  
> -	drmModeFreeResources(mode_resources);
> -
>  	if (!found)
>  		return std_1024_mode;
>  
> @@ -217,7 +191,7 @@ test_plane_position_with_output(data_t *data,
> enum pipe pipe,
>  
>  	mode1 = test_setup(data, pipe, modifier, output);
>  
> -	mode_lowres = get_lowres_mode(data->drm_fd, mode1);
> +	mode_lowres = get_lowres_mode(data->drm_fd, output, mode1);
>  
>  	ret = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
>  	igt_skip_on(ret != 0);


More information about the igt-dev mailing list