All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/3] drm/i915: Extract intel_atomic_swap_state()
Date: Tue, 19 Dec 2023 15:07:56 +0200	[thread overview]
Message-ID: <20231219130756.25986-4-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20231219130756.25986-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Pull all the state swap stuff into its own function to declutter
intel_atomic_commit() a bit.

Note that currently the state swap is spread across both
sides of the unprepare branch in intel_atomic_commit(), but
we can pull all of it ahead a bit since we bail on the first
error, and thus there is no change in behaviour from the
reordering.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 23 +++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 46eff0ee5519..bf37bfcf350e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7311,6 +7311,23 @@ static int intel_atomic_setup_commit(struct intel_atomic_state *state, bool nonb
 	return 0;
 }
 
+static int intel_atomic_swap_state(struct intel_atomic_state *state)
+{
+	int ret;
+
+	ret = drm_atomic_helper_swap_state(&state->base, true);
+	if (ret)
+		return ret;
+
+	intel_atomic_swap_global_state(state);
+
+	intel_shared_dpll_swap_state(state);
+
+	intel_atomic_track_fbs(state);
+
+	return 0;
+}
+
 int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state,
 			bool nonblock)
 {
@@ -7358,9 +7375,7 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state,
 
 	ret = intel_atomic_setup_commit(state, nonblock);
 	if (!ret)
-		ret = drm_atomic_helper_swap_state(&state->base, true);
-	if (!ret)
-		intel_atomic_swap_global_state(state);
+		ret = intel_atomic_swap_state(state);
 
 	if (ret) {
 		struct intel_crtc_state *new_crtc_state;
@@ -7374,8 +7389,6 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state,
 		intel_runtime_pm_put(&dev_priv->runtime_pm, state->wakeref);
 		return ret;
 	}
-	intel_shared_dpll_swap_state(state);
-	intel_atomic_track_fbs(state);
 
 	drm_atomic_state_get(&state->base);
 	INIT_WORK(&state->base.commit_work, intel_atomic_commit_work);
-- 
2.41.0


  parent reply	other threads:[~2023-12-19 13:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 13:07 [PATCH 0/3] drm/i915: Rework global state serialization Ville Syrjala
2023-12-19 13:07 ` [PATCH 1/3] drm/i915: Compute use_sagv_wm differently Ville Syrjala
2024-02-01  8:17   ` Lisovskiy, Stanislav
2023-12-19 13:07 ` [PATCH 2/3] drm/i915: Rework global state serializaiton Ville Syrjala
2024-02-01  8:48   ` Lisovskiy, Stanislav
2023-12-19 13:07 ` Ville Syrjala [this message]
2024-01-15 11:10   ` [PATCH 3/3] drm/i915: Extract intel_atomic_swap_state() Lisovskiy, Stanislav
2023-12-19 13:39 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Rework global state serialization Patchwork
2023-12-19 13:52 ` ✓ Fi.CI.BAT: success " Patchwork
2023-12-19 15:25 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-01-10 18:17 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Rework global state serialization (rev2) Patchwork
2024-01-10 18:30 ` ✓ Fi.CI.BAT: success " Patchwork
2024-01-10 22:20 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231219130756.25986-4-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.