Received: by 10.223.185.111 with SMTP id b44csp777924wrg; Fri, 9 Mar 2018 13:34:38 -0800 (PST) X-Google-Smtp-Source: AG47ELsmnLN+9vn+YrN0zBlAfvuJ2XezFAW8tRcOHer62QSPTehTKJihYCl5idoLRXVf4uvJvn0v X-Received: by 10.101.67.2 with SMTP id j2mr25434583pgq.147.1520631278222; Fri, 09 Mar 2018 13:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520631278; cv=none; d=google.com; s=arc-20160816; b=s/IU7QKbF84N6/a1YmVlvXVNt8fnuC9g2FlSfQpS2fOikPj+pPwDg4jQOR5D/6o9Pd 1g2r/QRGsdUcDQZik94Lf8/hfAE82bW0ME8sP+eI7Flxijhg5WUzV57PCD3am/5R+iR9 7w5tm3vkOPqoKmHcB7fFt/96WDiGIzhm0F56b77LPhJ8YGS/wx5MKu5LjLKw2oRN20JV kGtxMI2W1U3pGuEB9PhS+Jk9ulj5ixtLwSt56zlBWJGBeXcJpoU3yvFah1lhT0IoUM6j iFQTw6+YE+1mt6Oa/2eeIfMV00HirLSDh8jAnmAE/JnIHe1cfwZu27GP+b5qkv3smVol 4M8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=k1T3Nm1Vm0NLk0xJGjfdBh/B1Mfh+Q+UjwRm5Qmk/+I=; b=S9QVuf2Plw87pS1kUq1bWp7Mqjk9KGmSjoE7CPxZnGHzyr2NJo7SxV5gy0xwsnenyD IFBhvyWVjfgdeW9G53c3Z77whMwZXgzvUP1YNlAfURLr/ksNOTbIpjupsB0KMGoy9UrR yqE1l+rEKi65HLvrGrWEKcakAPZihtYdFVEMKILjG69TXO9ochMiDyKnndWV8IcCV3C/ LYbf2sUPE6xdAOFotgwy8Beork03F/6TH1ef9bkfu3wqyHGjMaKsVb8oSqNKVlbYLD12 W51GiqO8BCuQfRRyUVe1y/V11uKi+aNsCMgU8KTBLP0cqoRHunpvpSjGfKQ9kyU0W6TK mPlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10-v6si1545296plo.61.2018.03.09.13.34.23; Fri, 09 Mar 2018 13:34:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932556AbeCIVdJ (ORCPT + 99 others); Fri, 9 Mar 2018 16:33:09 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932133AbeCIVdG (ORCPT ); Fri, 9 Mar 2018 16:33:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED159D142C; Fri, 9 Mar 2018 21:33:05 +0000 (UTC) Received: from malachite.bss.redhat.com (dhcp-10-20-1-30.bss.redhat.com [10.20.1.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D7D99457F; Fri, 9 Mar 2018 21:33:05 +0000 (UTC) From: Lyude Paul To: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, Manasi Navare , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/5] drm/i915: Only use one link bw config for MST topologies Date: Fri, 9 Mar 2018 16:32:28 -0500 Message-Id: <20180309213232.19855-2-lyude@redhat.com> In-Reply-To: <20180309213232.19855-1-lyude@redhat.com> References: <20180308232421.14049-1-lyude@redhat.com> <20180309213232.19855-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Mar 2018 21:33:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Mar 2018 21:33:06 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lyude@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a DP MST link needs retraining, sometimes the hub will detect that the current link bw config is impossible and will update it's RX caps in the DPCD to reflect the new maximum link rate. Currently, we make the assumption that the RX caps in the dpcd will never change like this. This means if the sink changes it's RX caps after we've already set up an MST link and we attempt to add or remove another sink from the topology, we could put ourselves into an invalid state where we've tried to configure different sinks on the same MST topology with different link rates. We could also run into this situation if a sink reports a higher link rate after suspend, usually from us having trained it with a fallback bw configuration before suspending. So: "lock" the bw config by only using the max DP link rate/lane count on the first modeset for an MST topology. For every modeset following, we instead use the last configured link bw for this topology. We only unlock the bw config when we've detected a new MST sink. Signed-off-by: Lyude Paul Cc: Manasi Navare Cc: Ville Syrjälä --- drivers/gpu/drm/i915/intel_dp.c | 11 +++++++++-- drivers/gpu/drm/i915/intel_dp_mst.c | 22 +++++++++++++++------- drivers/gpu/drm/i915/intel_drv.h | 6 ++++++ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 5abf0c95725a..5645a194de92 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3871,18 +3871,25 @@ intel_dp_can_mst(struct intel_dp *intel_dp) static void intel_dp_configure_mst(struct intel_dp *intel_dp) { + bool was_mst; + if (!i915_modparams.enable_dp_mst) return; if (!intel_dp->can_mst) return; + was_mst = intel_dp->is_mst; intel_dp->is_mst = intel_dp_can_mst(intel_dp); - if (intel_dp->is_mst) + if (intel_dp->is_mst) { DRM_DEBUG_KMS("Sink is MST capable\n"); - else + + if (!was_mst) + intel_dp->mst_bw_locked = false; + } else { DRM_DEBUG_KMS("Sink is not MST capable\n"); + } drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index c3de0918ee13..c0553456b18e 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -42,7 +42,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, to_intel_connector(conn_state->connector); struct drm_atomic_state *state = pipe_config->base.state; int bpp; - int lane_count, slots; + int lane_count, link_rate, slots; const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; int mst_pbn; bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, @@ -56,16 +56,22 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, bpp); } /* - * for MST we always configure max link bw - the spec doesn't - * seem to suggest we should do otherwise. + * for MST we always configure max link bw if we don't know better - + * the spec doesn't seem to suggest we should do otherwise. But, + * ensure it always stays consistent with the rest of this hub's + * state. */ - lane_count = intel_dp_max_lane_count(intel_dp); + if (intel_dp->mst_bw_locked) { + lane_count = intel_dp->lane_count; + link_rate = intel_dp->link_rate; + } else { + lane_count = intel_dp_max_lane_count(intel_dp); + link_rate = intel_dp_max_link_rate(intel_dp); + } pipe_config->lane_count = lane_count; - pipe_config->pipe_bpp = bpp; - - pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); + pipe_config->port_clock = link_rate; if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) pipe_config->has_audio = true; @@ -221,6 +227,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder, connector->encoder = encoder; intel_mst->connector = connector; + intel_dp->mst_bw_locked = true; + DRM_DEBUG_KMS("active links %d\n", intel_dp->active_mst_links); drm_dp_send_power_updown_phy(&intel_dp->mst_mgr, connector->port, true); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 3f19dc80997f..fc338529e918 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1107,6 +1107,12 @@ struct intel_dp { bool can_mst; /* this port supports mst */ bool is_mst; int active_mst_links; + /* Set when we've already decided on a link bw for mst, to prevent us + * from setting different link bandwiths if the hub tries to confuse + * us by changing it later + */ + bool mst_bw_locked; + /* connector directly attached - won't be use for modeset in mst world */ struct intel_connector *attached_connector; -- 2.14.3