public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Sean Paul <seanpaul@chromium.org>, dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Extract intel_crtc_initial_commit()
Date: Thu, 15 Jul 2021 21:49:53 +0300	[thread overview]
Message-ID: <20210715184954.7794-4-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20210715184954.7794-1-ville.syrjala@linux.intel.com>

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

Extract intel_crtc_initial_commit() from intel_initial_commit().
Should make subsequent changes a bit less convoluted.

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 96 +++++++++++---------
 1 file changed, 52 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 65ddb6ca16e6..3718399c4c2f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -12129,12 +12129,60 @@ static void intel_update_fdi_pll_freq(struct drm_i915_private *dev_priv)
 	drm_dbg(&dev_priv->drm, "FDI PLL freq=%d\n", dev_priv->fdi_pll_freq);
 }
 
+static int intel_crtc_initial_commit(struct intel_atomic_state *state,
+				     struct intel_crtc *crtc)
+{
+	struct intel_crtc_state *crtc_state;
+	struct intel_encoder *encoder;
+	int ret;
+
+	crtc_state = intel_atomic_get_crtc_state(&state->base, crtc);
+	if (IS_ERR(crtc_state))
+		return PTR_ERR(crtc_state);
+
+	if (!crtc_state->hw.active)
+		return 0;
+
+	/*
+	 * We've not yet detected sink capabilities
+	 * (audio,infoframes,etc.) and thus we don't want to
+	 * force a full state recomputation yet. We want that to
+	 * happen only for the first real commit from userspace.
+	 * So preserve the inherited flag for the time being.
+	 */
+	crtc_state->inherited = true;
+
+	ret = drm_atomic_add_affected_planes(&state->base, &crtc->base);
+	if (ret)
+		return ret;
+
+	/*
+	 * FIXME hack to force a LUT update to avoid the
+	 * plane update forcing the pipe gamma on without
+	 * having a proper LUT loaded. Remove once we
+	 * have readout for pipe gamma enable.
+	 */
+	crtc_state->uapi.color_mgmt_changed = true;
+
+	for_each_intel_encoder_mask(state->base.dev, encoder, crtc_state->uapi.encoder_mask) {
+		if (encoder->initial_fastset_check &&
+		    !encoder->initial_fastset_check(encoder, crtc_state)) {
+			ret = drm_atomic_add_affected_connectors(&state->base,
+								 &crtc->base);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int intel_initial_commit(struct drm_device *dev)
 {
-	struct drm_atomic_state *state = NULL;
 	struct drm_modeset_acquire_ctx ctx;
+	struct drm_atomic_state *state;
 	struct intel_crtc *crtc;
-	int ret = 0;
+	int ret;
 
 	state = drm_atomic_state_alloc(dev);
 	if (!state)
@@ -12146,49 +12194,9 @@ static int intel_initial_commit(struct drm_device *dev)
 	state->acquire_ctx = &ctx;
 
 	for_each_intel_crtc(dev, crtc) {
-		struct intel_crtc_state *crtc_state =
-			intel_atomic_get_crtc_state(state, crtc);
-
-		if (IS_ERR(crtc_state)) {
-			ret = PTR_ERR(crtc_state);
+		ret = intel_crtc_initial_commit(to_intel_atomic_state(state), crtc);
+		if (ret)
 			goto out;
-		}
-
-		if (crtc_state->hw.active) {
-			struct intel_encoder *encoder;
-
-			/*
-			 * We've not yet detected sink capabilities
-			 * (audio,infoframes,etc.) and thus we don't want to
-			 * force a full state recomputation yet. We want that to
-			 * happen only for the first real commit from userspace.
-			 * So preserve the inherited flag for the time being.
-			 */
-			crtc_state->inherited = true;
-
-			ret = drm_atomic_add_affected_planes(state, &crtc->base);
-			if (ret)
-				goto out;
-
-			/*
-			 * FIXME hack to force a LUT update to avoid the
-			 * plane update forcing the pipe gamma on without
-			 * having a proper LUT loaded. Remove once we
-			 * have readout for pipe gamma enable.
-			 */
-			crtc_state->uapi.color_mgmt_changed = true;
-
-			for_each_intel_encoder_mask(dev, encoder,
-						    crtc_state->uapi.encoder_mask) {
-				if (encoder->initial_fastset_check &&
-				    !encoder->initial_fastset_check(encoder, crtc_state)) {
-					ret = drm_atomic_add_affected_connectors(state,
-										 &crtc->base);
-					if (ret)
-						goto out;
-				}
-			}
-		}
 	}
 
 	ret = drm_atomic_commit(state);
-- 
2.31.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-07-15 18:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 18:49 [Intel-gfx] [PATCH 0/4] drm: Make modeset locking easier Ville Syrjala
2021-07-15 18:49 ` [Intel-gfx] [PATCH 1/4] drm: Introduce drm_modeset_lock_ctx_retry() Ville Syrjala
2021-07-20 13:44   ` Daniel Vetter
2021-10-04 11:15     ` Ville Syrjälä
2021-10-13 11:59       ` Daniel Vetter
2021-10-13 12:06         ` Ville Syrjälä
2021-10-13 21:00           ` Fernando Ramos
2021-10-14 13:23             ` Daniel Vetter
2021-07-15 18:49 ` [Intel-gfx] [PATCH 2/4] drm: Introduce drm_modeset_lock_all_ctx_retry() Ville Syrjala
2021-07-15 18:49 ` Ville Syrjala [this message]
2021-07-15 18:49 ` [Intel-gfx] [PATCH 4/4] drm/i915: Use drm_modeset_lock_ctx_retry() & co Ville Syrjala
2021-07-16 22:21 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Make modeset locking easier Patchwork
2021-07-16 22:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-07-16 22:27 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-07-16 22:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-17  7:20 ` [Intel-gfx] ✗ 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=20210715184954.7794-4-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox