From patchwork Tue Mar 5 08:47:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13581849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 35E12C54798 for ; Tue, 5 Mar 2024 08:47:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C8F0112955; Tue, 5 Mar 2024 08:47:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="k9B335GT"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F0A8112955 for ; Tue, 5 Mar 2024 08:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709628456; x=1741164456; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=NlTwewarQDherdK37fYzgVzzelU0UAjWPs0NUHMsz5w=; b=k9B335GTPPZfxUqAjnlZRH0Gomv+x1K78MBzY3J7ShPtjzgBKBN4QlI6 WAk3F5U1Ba3ZpoHc8apTLUz3BC8nV4Gn4iDAMyXm4Io9cividmigT8eW9 xe5o1QB5GJy6qrDmquj1BzkpXMYB+bZr5MXsWOUna31Z2Blc3S0ZBfztG 1UwJUpO2/+yeiRPLB3DOqiy2tUTdk7bYqSyOdZkRPw3lM6vsZtHIJ8Nt2 tMjk6VAu0+vV3FT68u/QRtVfoa3aJGSo+QJ3mwGCaW0PM9Kr/hWr9Im6Z veFmop5eo+8R4ZzmOqflk7LVtZNYqRimba8zklyEvdg1n15ebGgGrFsQv A==; X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="7112466" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="7112466" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2024 00:47:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="827773663" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="827773663" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 05 Mar 2024 00:47:34 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 05 Mar 2024 10:47:33 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/3] drm/i915: Precompute disable_pipes bitmask in intel_commit_modeset_disables() Date: Tue, 5 Mar 2024 10:47:28 +0200 Message-ID: <20240305084730.19182-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240305084730.19182-1-ville.syrjala@linux.intel.com> References: <20240305084730.19182-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Copy the pipe bitmask based approach skl_commit_modeset_enables() into intel_commit_modeset_disables(). This avoids doing so many duplicated checks in all the loops, and also let's us WARN at the end if we screwed up somewhere and forgot to disable some pipe. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 27 ++++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index ab2f52d21bad..d1c947a310a3 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -6768,9 +6768,10 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state, static void intel_commit_modeset_disables(struct intel_atomic_state *state) { + struct drm_i915_private *i915 = to_i915(state->base.dev); struct intel_crtc_state *new_crtc_state, *old_crtc_state; struct intel_crtc *crtc; - u32 handled = 0; + u8 disable_pipes = 0; int i; for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, @@ -6778,21 +6779,24 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) if (!intel_crtc_needs_modeset(new_crtc_state)) continue; + /* + * Needs to be done even for pipes + * that weren't enabled previously. + */ intel_pre_plane_update(state, crtc); if (!old_crtc_state->hw.active) continue; intel_crtc_disable_planes(state, crtc); + + disable_pipes |= BIT(crtc->pipe); } /* Only disable port sync and MST slaves */ for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { - if (!intel_crtc_needs_modeset(new_crtc_state)) - continue; - - if (!old_crtc_state->hw.active) + if ((disable_pipes & BIT(crtc->pipe)) == 0) continue; /* In case of Transcoder port Sync master slave CRTCs can be @@ -6807,22 +6811,23 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) intel_old_crtc_state_disables(state, old_crtc_state, new_crtc_state, crtc); - handled |= BIT(crtc->pipe); + + disable_pipes &= ~BIT(crtc->pipe); } /* Disable everything else left on */ for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { - if (!intel_crtc_needs_modeset(new_crtc_state) || - (handled & BIT(crtc->pipe))) - continue; - - if (!old_crtc_state->hw.active) + if ((disable_pipes & BIT(crtc->pipe)) == 0) continue; intel_old_crtc_state_disables(state, old_crtc_state, new_crtc_state, crtc); + + disable_pipes &= ~BIT(crtc->pipe); } + + drm_WARN_ON(&i915->drm, disable_pipes); } static void intel_commit_modeset_enables(struct intel_atomic_state *state) From patchwork Tue Mar 5 08:47:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13581850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 05201C54798 for ; Tue, 5 Mar 2024 08:47:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61998112957; Tue, 5 Mar 2024 08:47:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Uvt+RNjy"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9C196112956 for ; Tue, 5 Mar 2024 08:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709628460; x=1741164460; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=kydhrfJNQZa2cTxCFBQ+7lUW9ws/JHpzERbAIEwp+cs=; b=Uvt+RNjyfSGuhCNFvJi9s0l8ugjhlCbWbrDZjo70kUK/Vtk2utNNruqC wP7sV/0crhOap7x9S9vWXGPvKxw3IlaU5pd9KDG/X+3WtGtejYdNOS9tw ncDAUnTeTGezUS79TRDcRzfMFYeyxHvxOdyPSMLIuv423eKpDS5en9MOz raR1yW7njH30uk8tYSjKQePKSmkdfL5S44Dr+2tHxFbnBJHwLBm8QLUzT m9WU2WFgqWrgdegScc9pAR8EDqJTsC+tRos3QjEqhK6nnOdN4ROkiDQWx nH7K3+75kJxzvUCMPcqdAN5i6156FHHVEINRQkCGeyJXjSSZptf3eiYSs Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="7112469" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="7112469" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2024 00:47:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="827773664" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="827773664" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 05 Mar 2024 00:47:37 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 05 Mar 2024 10:47:36 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/3] drm/i915: Disable planes more atomically during modesets Date: Tue, 5 Mar 2024 10:47:29 +0200 Message-ID: <20240305084730.19182-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240305084730.19182-1-ville.syrjala@linux.intel.com> References: <20240305084730.19182-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Follow in the footsteps of commit c610e841f19d ("drm/i915: Do plane/etc. updates more atomically across pipes") and do the plane disables back to back for all pipes also when we are disabling pipes. This should provide for a potentially more atomic user experience, which might be especially nice when using joiner or tiled displays. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index d1c947a310a3..d1902976084e 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -6788,11 +6788,16 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) if (!old_crtc_state->hw.active) continue; - intel_crtc_disable_planes(state, crtc); - disable_pipes |= BIT(crtc->pipe); } + for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) { + if ((disable_pipes & BIT(crtc->pipe)) == 0) + continue; + + intel_crtc_disable_planes(state, crtc); + } + /* Only disable port sync and MST slaves */ for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { From patchwork Tue Mar 5 08:47:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13581851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3929FC54E41 for ; Tue, 5 Mar 2024 08:47:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5CB5112956; Tue, 5 Mar 2024 08:47:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="OREW7a44"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12C6B112956 for ; Tue, 5 Mar 2024 08:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709628463; x=1741164463; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=B5l09z5H05ckx7dDOS5rS5uqDwtJ9KO4sFXHzCFu5OE=; b=OREW7a44SkcilTmsFYK6WxbRuugLrceTqw6UCd5MBnm2vjucwmCueCxI BfSo6KfeN7Q+XUeOIvrnWe7Apr+hLEuv2r8NAgFmicPxOpeSqqQkoVxWB 5ZuIPrJ2An6OpIki1MaQPYozHnd81ruZDGBk/Xt9Ycj6bxShfe5irBote bGO4UiYiz7elpvqpM6925loluyhTsC5mcogE3YAkoXAsucEij8UdH441X zqtT49Q882XgjD2nhXN+nPidDI3r41amv5FsgFwz5AawnGRHBRtPHTQ02 75Wn4l5hiDifin+3xfal/6fGD5eQR9R7ZwvKkMxMcotT9SKm+/7nqtcHv g==; X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="7112474" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="7112474" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2024 00:47:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="827773665" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="827773665" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 05 Mar 2024 00:47:40 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 05 Mar 2024 10:47:39 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/3] drm/i915: Simplify intel_old_crtc_state_disables() calling convention Date: Tue, 5 Mar 2024 10:47:30 +0200 Message-ID: <20240305084730.19182-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240305084730.19182-1-ville.syrjala@linux.intel.com> References: <20240305084730.19182-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Stop passing in so much redundant stuff to intel_old_crtc_state_disables(). Top level atomic state + crtc is all we need. And while at it constify the states to make it clear they should not be mutated. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index d1902976084e..86f4229120c4 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -6746,11 +6746,11 @@ static void intel_update_crtc(struct intel_atomic_state *state, } static void intel_old_crtc_state_disables(struct intel_atomic_state *state, - struct intel_crtc_state *old_crtc_state, - struct intel_crtc_state *new_crtc_state, struct intel_crtc *crtc) { struct drm_i915_private *dev_priv = to_i915(state->base.dev); + const struct intel_crtc_state *new_crtc_state = + intel_atomic_get_new_crtc_state(state, crtc); /* * We need to disable pipe CRC before disabling the pipe, @@ -6769,7 +6769,7 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state, static void intel_commit_modeset_disables(struct intel_atomic_state *state) { struct drm_i915_private *i915 = to_i915(state->base.dev); - struct intel_crtc_state *new_crtc_state, *old_crtc_state; + const struct intel_crtc_state *new_crtc_state, *old_crtc_state; struct intel_crtc *crtc; u8 disable_pipes = 0; int i; @@ -6799,8 +6799,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) } /* Only disable port sync and MST slaves */ - for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { + for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) { if ((disable_pipes & BIT(crtc->pipe)) == 0) continue; @@ -6814,20 +6813,17 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) !intel_crtc_is_bigjoiner_slave(old_crtc_state)) continue; - intel_old_crtc_state_disables(state, old_crtc_state, - new_crtc_state, crtc); + intel_old_crtc_state_disables(state, crtc); disable_pipes &= ~BIT(crtc->pipe); } /* Disable everything else left on */ - for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { + for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) { if ((disable_pipes & BIT(crtc->pipe)) == 0) continue; - intel_old_crtc_state_disables(state, old_crtc_state, - new_crtc_state, crtc); + intel_old_crtc_state_disables(state, crtc); disable_pipes &= ~BIT(crtc->pipe); }