[igt-dev] [PATCH i-g-t 1/2] tests/kms_dp_aux_dev: Factor out helper checking for sink detect errors

Sripada, Radhakrishna radhakrishna.sripada at intel.com
Thu Mar 23 23:10:52 UTC 2023



> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Imre Deak
> Sent: Thursday, March 23, 2023 9:18 AM
> To: igt-dev at lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 1/2] tests/kms_dp_aux_dev: Factor out helper
> checking for sink detect errors
> 
> For clarity, factor out a helper to check if the AUX transfer failed
> due to not detecting the sink being connected.
> 
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada at intel.com>

> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  tests/kms_dp_aux_dev.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/kms_dp_aux_dev.c b/tests/kms_dp_aux_dev.c
> index 850ec8e26..86e111bf2 100644
> --- a/tests/kms_dp_aux_dev.c
> +++ b/tests/kms_dp_aux_dev.c
> @@ -42,6 +42,19 @@ static bool is_mst_connector(int drm_fd, uint32_t
> connector_id)
>  				    NULL, NULL);
>  }
> 
> +static bool sink_detect_error(int drm_fd, uint32_t connector_id, int
> error_code)
> +{
> +	switch (error_code) {
> +	case ETIMEDOUT:
> +		return true;
> +	case EIO:
> +		return is_mst_connector(drm_fd, connector_id) ||
> +		       is_amdgpu_device(drm_fd);
> +	default:
> +		return false;
> +	};
> +}
> +
>  static bool test(int drm_fd, uint32_t connector_id)
>  {
>  	drmModeConnector *connector;
> @@ -85,9 +98,7 @@ static bool test(int drm_fd, uint32_t connector_id)
>  			 ret > 0 ? "success" : strerror(errno));
> 
>  		igt_assert(ret == sizeof(buf) ||
> -			   errno == ETIMEDOUT ||
> -			   (errno == EIO && (is_mst_connector(drm_fd,
> connector_id) ||
> -			    is_amdgpu_device(drm_fd))));
> +			   sink_detect_error(drm_fd, connector_id, errno));
> 
>  		close(fd);
> 
> --
> 2.37.1



More information about the igt-dev mailing list