From patchwork Mon Dec 23 01:06:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 11307733 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 E2B4513A4 for ; Mon, 23 Dec 2019 01:07:22 +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 CB94F206D3 for ; Mon, 23 Dec 2019 01:07:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB94F206D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 707CB6E0FD; Mon, 23 Dec 2019 01:07:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C2F56E12E for ; Mon, 23 Dec 2019 01:07:20 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Dec 2019 17:07:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,345,1571727600"; d="scan'208";a="219359042" Received: from dtbingha-mobl.amr.corp.intel.com (HELO josouza-MOBL.amr.corp.intel.com) ([10.252.135.10]) by orsmga003.jf.intel.com with ESMTP; 22 Dec 2019 17:07:17 -0800 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: intel-gfx@lists.freedesktop.org Date: Sun, 22 Dec 2019 17:06:53 -0800 Message-Id: <20191223010654.67037-6-jose.souza@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191223010654.67037-1-jose.souza@intel.com> References: <20191223010654.67037-1-jose.souza@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v6 rebased 6/7] drm/i915/mst: Force modeset on MST slaves when master needs a modeset X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lucas De Marchi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" MST master can not be disabled while it have attached MST slaves, so it is necessary force a modeset in all of its slaves. v3: - moved handling to intel_atomic_check() this way is guarantee that all pipes will have its state computed v4: - added a function to return if MST master neeeds modeset to simply code in intel_atomic_check() v5: - fixed and moved code to check if MST master needs a modeset v6: - previons version of this patch was split into two patches Cc: Ville Syrjälä Cc: Lucas De Marchi Reviewed-by: Ville Syrjälä Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/i915/display/intel_display.c | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 3c5cf2623182..32e1fdfceac7 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -14036,6 +14036,20 @@ static int intel_atomic_check_crtcs(struct intel_atomic_state *state) return 0; } +static bool intel_cpu_transcoder_needs_modeset(struct intel_atomic_state *state, + enum transcoder transcoder) +{ + struct intel_crtc_state *new_crtc_state; + struct intel_crtc *crtc; + int i; + + for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) + if (new_crtc_state->cpu_transcoder == transcoder) + return needs_modeset(new_crtc_state); + + return false; +} + /** * intel_atomic_check - validate state object * @dev: drm device @@ -14088,6 +14102,28 @@ static int intel_atomic_check(struct drm_device *dev, intel_crtc_check_fastset(old_crtc_state, new_crtc_state); } + /** + * Check if fastset is allowed by external dependencies like other + * pipes and transcoders. + * + * Right now it only forces a fullmodeset when the MST master + * transcoder did not changed but the pipe of the master transcoder + * needs a fullmodeset so all slaves also needs to do a fullmodeset. + */ + for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { + enum transcoder master = new_crtc_state->mst_master_transcoder; + + if (!new_crtc_state->hw.enable || + needs_modeset(new_crtc_state) || + !intel_dp_mst_is_slave_trans(new_crtc_state)) + continue; + + if (intel_cpu_transcoder_needs_modeset(state, master)) { + new_crtc_state->uapi.mode_changed = true; + new_crtc_state->update_pipe = false; + } + } + for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (needs_modeset(new_crtc_state)) {