[igt-dev] [PATCH i-g-t v2 2/2] lib/igt_kms: handle spurious HPDs - IGT part

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Mar 8 18:31:03 UTC 2023


Hi Vinod,

please drop "- IGT part" from subject.

Regards,
Kamil

On 2023-02-14 at 11:57:24 +0200, Vinod Govindapillai wrote:
> Some panels generate long HPDs during CI execution steps even
> while connected to the system and cause unexpected CI execution
> failures. In environments like CI, we don't expect to disconnect
> the panels in the middle of the CI execution.
> 
> There are two parts to handle this case - display driver and IGT
> 
> 1. In the display driver, based on a flag, long HPDs are
> ignored. This flag can be set/unset using debugfs on systems
> where such panels are connected.
> 
> 2. In IGT, add provision to set ignore long HPD debugfs entry
> on the driver and also set Force "on" the active connectors.
> With force on, the connector's detect sequences will not get
> initiated.
> 
> This patch handles the IGT part.
> 
> An enviroment variable "IGT_KMS_IGNORE_HPD" is added to
> differentiate systems which require such spurious HPD handling.
> If this variable is on, ignore long HPD debugs entry is set and
> active connectors are set to force "on" state.
> 
> Many thanks to "Imre Deak" for the suggestions and support
> 
> v2: Minor updates in the comments.
> 
> Cc: Imre Deak <imre.deak at intel.com>
> Signed-off-by: Vinod Govindapillai <vinod.govindapillai at intel.com>
> ---
>  lib/igt_kms.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 51 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 8c7dd85b..f99ab183 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -2390,6 +2390,51 @@ static bool igt_pipe_has_valid_output(igt_display_t *display, enum pipe pipe)
>  	return false;
>  }
>  
> +/**
> + * igt_handle_spurious_hpd:
> + * @display: a pointer to igt_display_t structure
> + *
> + * Handle environment variable "IGT_KMS_IGNORE_HPD" to manage the spurious
> + * HPD cases in CI systems where such spurious HPDs are generated by the
> + * panels without any specific reasons and cause CI execution failures.
> + *
> + * This will set the i915_ignore_long_hpd debugfs entry to 1 as a cue for
> + * the driver to start ignoring the HPDs.
> + *
> + * Also, this will set the active connectors' force status to "on"
> + * so that dp/hdmi_detect routines don't get called frequently.
> + *
> + * Force status is kept on after this until it is manually reset.
> + */
> +static void igt_handle_spurious_hpd(igt_display_t *display)
> +{
> +	igt_output_t *output;
> +
> +	/* Proceed with spurious HPD handling only if the env var is set */
> +	if (!getenv("IGT_KMS_IGNORE_HPD"))
> +		return;
> +
> +	/* Set the ignore HPD for the driver */
> +	igt_ignore_long_hpd(display->drm_fd, true);
> +
> +	for_each_connected_output(display, output) {
> +		drmModeConnector *conn = output->config.connector;
> +
> +		if (!force_connector(display->drm_fd, conn, "on")) {
> +			igt_info("Unable to force state on %s-%d\n",
> +				 kmstest_connector_type_str(conn->connector_type),
> +				 conn->connector_type_id);
> +			continue;
> +		}
> +
> +		igt_info("Force connector ON for %s-%d\n",
> +			 kmstest_connector_type_str(conn->connector_type),
> +			 conn->connector_type_id);
> +	}
> +
> +	dump_forced_connectors();
> +}
> +
>  /**
>   * igt_display_require:
>   * @display: a pointer to an initialized #igt_display_t structure
> @@ -2713,11 +2758,15 @@ void igt_display_require(igt_display_t *display, int drm_fd)
>  out:
>  	LOG_UNINDENT(display);
>  
> -	if (display->n_pipes && display->n_outputs)
> +	if (display->n_pipes && display->n_outputs) {
>  		igt_enable_connectors(drm_fd);
> -	else
> +
> +		igt_handle_spurious_hpd(display);
> +	}
> +	else {
>  		igt_skip("No KMS driver or no outputs, pipes: %d, outputs: %d\n",
>  			 display->n_pipes, display->n_outputs);
> +	}
>  }
>  
>  /**
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list