From patchwork Tue Jun 16 21:11:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 11608705 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B16A992A for ; Tue, 16 Jun 2020 21:11:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99EDD2085B for ; Tue, 16 Jun 2020 21:11:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99EDD2085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F97A6E999; Tue, 16 Jun 2020 21:11:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FA6A6E93B; Tue, 16 Jun 2020 21:11:52 +0000 (UTC) IronPort-SDR: 1jnM+SLs88gSDZMSCcrUIMYmi0EPuKwfsIEYu7zl59GVAc5DhxWuWxK+tSDRjD94V/WmPP3o/N JKcW9VgK+gbA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 14:11:52 -0700 IronPort-SDR: 0uisvkeuX4QnnT7E4MsEs84glmVJQEpFgRRW4M42qpaulOk2YlrAaeJXz5O+4Hk37yrtrey0p3 h/NaYtpHklpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,519,1583222400"; d="scan'208";a="273288328" Received: from ideak-desk.fi.intel.com ([10.237.72.183]) by orsmga003.jf.intel.com with ESMTP; 16 Jun 2020 14:11:50 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2 6/6] drm/i915/dp_mst: Ensure the DPCD ACT sent flag is cleared before waiting for it Date: Wed, 17 Jun 2020 00:11:46 +0300 Message-Id: <20200616211146.23027-3-imre.deak@intel.com> X-Mailer: git-send-email 2.23.1 In-Reply-To: <20200616141855.746-6-imre.deak@intel.com> References: <20200616141855.746-6-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Atm, we clear the ACT sent flag in the sink's DPCD before updating the sink's payload table, along clearing the payload table updated flag. The sink is supposed to set this flag once it detects that the source has completed the ACT sequence (after detecting the 4 required ACT MTPH symbols sent by the source). As opposed to this 2 DELL monitors I have set the flag already along the payload table updated flag, which is not quite correct. To be sure that the sink has detected the ACT MTPH symbols before continuing enabling the encoder, clear the ACT sent flag before enabling or disabling the transcoder VC payload allocation (which is what starts the ACT sequence). v2 (Ville): - Use the correct bit to clear the flags. - Add code comment explaining the clearing semantics of the ACT handled flag. Cc: Lyude Paul Cc: Ville Syrjälä Cc: dri-devel@lists.freedesktop.org Signed-off-by: Imre Deak Reviewed-by: Lyude Paul --- drivers/gpu/drm/drm_dp_mst_topology.c | 38 +++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 ++ include/drm/drm_dp_mst_helper.h | 2 ++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index b2f5a84b4cfb..1f5d14128c1a 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -4377,6 +4377,41 @@ void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, } EXPORT_SYMBOL(drm_dp_mst_deallocate_vcpi); +/** + * drm_dp_clear_payload_status() - Clears the payload table status flags + * @mgr: manager to use + * + * Clears the payload table ACT handled and table updated flags in the MST hub's + * DPCD. This function must be called before updating the payload table or + * starting the ACT sequence and waiting for the corresponding flags to get + * set by the hub. + * + * Returns: + * 0 if the flags got cleared successfully, otherwise a negative error code. + */ +int drm_dp_clear_payload_status(struct drm_dp_mst_topology_mgr *mgr) +{ + int ret; + + /* + * Note that the following is based on the DP Standard stating that + * writing the DP_PAYLOAD_TABLE_UPDATED bit alone will clear both the + * DP_PAYLOAD_TABLE_UPDATED and the DP_PAYLOAD_ACT_HANDLED flags. This + * seems to be also the only way to clear DP_PAYLOAD_ACT_HANDLED. + */ + ret = drm_dp_dpcd_writeb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, + DP_PAYLOAD_TABLE_UPDATED); + if (ret < 0) { + DRM_DEBUG_DRIVER("Can't clear the ACT handled/table updated flags (%d)\n", + ret); + return ret; + } + WARN_ON(ret != 1); + + return 0; +} +EXPORT_SYMBOL(drm_dp_clear_payload_status); + static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr, int id, struct drm_dp_payload *payload) { @@ -4384,8 +4419,7 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr, int ret; int retries = 0; - drm_dp_dpcd_writeb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, - DP_PAYLOAD_TABLE_UPDATED); + drm_dp_clear_payload_status(mgr); payload_alloc[0] = id; payload_alloc[1] = payload->start_slot; diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 9308b5920780..3c4b0fb10d8b 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -323,6 +323,8 @@ static void clear_act_sent(struct intel_dp *intel_dp) intel_de_write(i915, intel_dp->regs.dp_tp_status, DP_TP_STATUS_ACT_SENT); + + drm_dp_clear_payload_status(&intel_dp->mst_mgr); } static void wait_for_act_sent(struct intel_dp *intel_dp) diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 8b9eb4db3381..2facb87624bf 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -763,6 +763,8 @@ int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, int pbn); +int drm_dp_clear_payload_status(struct drm_dp_mst_topology_mgr *mgr); + int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);