Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 22DA810E991 for ; Thu, 9 Feb 2023 10:19:23 +0000 (UTC) From: Vinod Govindapillai To: igt-dev@lists.freedesktop.org Date: Thu, 9 Feb 2023 12:19:04 +0200 Message-Id: <20230209101904.998315-3-vinod.govindapillai@intel.com> In-Reply-To: <20230209101904.998315-1-vinod.govindapillai@intel.com> References: <20230209101904.998315-1-vinod.govindapillai@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t 2/2] lib/igt_kms: handle spurious HPDs - IGT part List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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. Cc: Imre Deak Signed-off-by: Vinod Govindapillai --- lib/igt_kms.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 8c7dd85b..dfa258f6 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -2390,6 +2390,52 @@ static bool igt_pipe_has_valid_output(igt_display_t *display, enum pipe pipe) return false; } +/* + * Provision to handle spurious HPD issues in CI + * @display: a pointer to igt_display_t structure + * @drm_fd: drm file descriptor + * + * 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_suppress_wakeup_hpd debugfs entry to true for + * the driver so that the driver will start ignoring the long HPDs. + * + * Also, this will set the active connectors' force status to "on" for the + * connectors 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 +2759,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