All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [RFC PATCH 6/7] drm/i915: Always reset in intel_crtc_restore_mode
Date: Fri, 19 Jun 2015 10:02:29 +0200	[thread overview]
Message-ID: <1434700950-16242-7-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1434700950-16242-1-git-send-email-maarten.lankhorst@linux.intel.com>

And get rid of things that are no longer true. This function is only
used for forcing a modeset when encoder properties are changed.

All the existing state is fine in this case, only setting mode_changed
will force a full recalculation here, and take all the state needed.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 62 +++++++++++-------------------------
 1 file changed, 18 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 942d25e7490a..796d08c4606e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13174,66 +13174,40 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_atomic_state *state;
-	struct intel_crtc *intel_crtc;
-	struct intel_encoder *encoder;
-	struct intel_connector *connector;
-	struct drm_connector_state *connector_state;
-	struct intel_crtc_state *crtc_state;
+	struct drm_crtc_state *crtc_state;
 	int ret;
 
 	state = drm_atomic_state_alloc(dev);
 	if (!state) {
-		DRM_DEBUG_KMS("[CRTC:%d] mode restore failed, out of memory",
+		DRM_DEBUG_KMS("[CRTC:%d] crtc restore failed, out of memory",
 			      crtc->base.id);
 		return;
 	}
 
-	state->acquire_ctx = dev->mode_config.acquire_ctx;
-
-	/* The force restore path in the HW readout code relies on the staged
-	 * config still keeping the user requested config while the actual
-	 * state has been overwritten by the configuration read from HW. We
-	 * need to copy the staged config to the atomic state, otherwise the
-	 * mode set will just reapply the state the HW is already in. */
-	for_each_intel_encoder(dev, encoder) {
-		if (encoder->base.crtc != crtc)
-			continue;
+	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
 
-		for_each_intel_connector(dev, connector) {
-			if (connector->base.state->best_encoder != &encoder->base)
-				continue;
-
-			connector_state = drm_atomic_get_connector_state(state, &connector->base);
-			if (IS_ERR(connector_state)) {
-				DRM_DEBUG_KMS("Failed to add [CONNECTOR:%d:%s] to state: %ld\n",
-					      connector->base.base.id,
-					      connector->base.name,
-					      PTR_ERR(connector_state));
-				continue;
-			}
+retry:
+	crtc_state = drm_atomic_get_crtc_state(state, crtc);
+	ret = PTR_ERR_OR_ZERO(crtc_state);
+	if (!ret) {
+		if (!crtc_state->active)
+			goto out;
 
-			connector_state->crtc = crtc;
-		}
+		crtc_state->mode_changed = true;
+		ret = intel_modeset_compute_config(state);
 	}
 
-	for_each_intel_crtc(dev, intel_crtc) {
-		crtc_state = intel_atomic_get_crtc_state(state, intel_crtc);
-		if (IS_ERR(crtc_state)) {
-			DRM_DEBUG_KMS("Failed to add [CRTC:%d] to state: %ld\n",
-				      intel_crtc->base.base.id,
-				      PTR_ERR(crtc_state));
-			continue;
-		}
+	if (!ret)
+		ret = intel_set_mode_checked(state);
 
-		if (&intel_crtc->base == crtc)
-			drm_mode_copy(&crtc_state->base.mode, &crtc->mode);
+	if (ret == -EDEADLK) {
+		drm_atomic_state_clear(state);
+		drm_modeset_backoff(state->acquire_ctx);
+		goto retry;
 	}
 
-	intel_modeset_setup_plane_state(state, crtc, &crtc->mode,
-					crtc->primary->fb, crtc->x, crtc->y);
-
-	ret = intel_set_mode(state);
 	if (ret)
+out:
 		drm_atomic_state_free(state);
 }
 
-- 
2.1.0

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

  parent reply	other threads:[~2015-06-19  8:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  8:02 [RFC PATCH 0/7] Convert to atomic, part 4 Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 1/7] drm/i915: Do not update pfit state when toggling crtc enabled Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 2/7] drm/i915: Read hw state into an atomic state struct, try 2 Maarten Lankhorst
2015-06-19  9:38   ` Daniel Stone
2015-06-22 15:31   ` Daniel Vetter
2015-06-23 10:49     ` Maarten Lankhorst
2015-06-23 11:40       ` Daniel Vetter
2015-06-19  8:02 ` [RFC PATCH 3/7] All changes from try2 Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 4/7] drm/i915: enable fastboot for everyone Maarten Lankhorst
2015-06-22 15:21   ` Daniel Vetter
2015-06-23 10:38     ` Maarten Lankhorst
2015-06-23 11:50       ` Daniel Vetter
2015-06-19  8:02 ` [RFC PATCH 5/7] drm/i915: Update power domains only on affected crtc's Maarten Lankhorst
2015-06-19  8:02 ` Maarten Lankhorst [this message]
2015-06-22 15:25   ` [RFC PATCH 6/7] drm/i915: Always reset in intel_crtc_restore_mode Daniel Vetter
2015-06-19  8:02 ` [RFC PATCH 7/7] drm/i915: Make intel_display_suspend atomic, try 2 Maarten Lankhorst
2015-06-22 14:54 ` [RFC PATCH 0/7] Convert to atomic, part 4 Daniel Vetter

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=1434700950-16242-7-git-send-email-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@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.