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: [PATCH v2 01/12] drm/i915: Make the force_thru workaround atomic.
Date: Mon, 27 Jul 2015 14:35:30 +0200	[thread overview]
Message-ID: <1438000541-3219-2-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1438000541-3219-1-git-send-email-maarten.lankhorst@linux.intel.com>

Set active_changed to force a modeset if the panel fitter's force
enabled.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c  | 82 +++++++++++-------------------------
 drivers/gpu/drm/i915/intel_display.c |  3 ++
 2 files changed, 27 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 23a69307e12e..22467adee958 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3645,74 +3645,40 @@ static int ilk_pipe_crc_ctl_reg(enum intel_pipe_crc_source *source,
 	return 0;
 }
 
-static void hsw_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
+static void hsw_trans_edp_pipe_A_crc_wa(struct drm_device *dev, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *crtc =
 		to_intel_crtc(dev_priv->pipe_to_crtc_mapping[PIPE_A]);
 	struct intel_crtc_state *pipe_config;
+	struct drm_atomic_state *state;
+	int ret = 0;
 
 	drm_modeset_lock_all(dev);
-	pipe_config = to_intel_crtc_state(crtc->base.state);
-
-	/*
-	 * If we use the eDP transcoder we need to make sure that we don't
-	 * bypass the pfit, since otherwise the pipe CRC source won't work. Only
-	 * relevant on hsw with pipe A when using the always-on power well
-	 * routing.
-	 */
-	if (pipe_config->cpu_transcoder == TRANSCODER_EDP &&
-	    !pipe_config->pch_pfit.enabled) {
-		bool active = pipe_config->base.active;
-
-		if (active) {
-			intel_crtc_control(&crtc->base, false);
-			pipe_config = to_intel_crtc_state(crtc->base.state);
-		}
-
-		pipe_config->pch_pfit.force_thru = true;
-
-		intel_display_power_get(dev_priv,
-					POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));
-
-		if (active)
-			intel_crtc_control(&crtc->base, true);
+	state = drm_atomic_state_alloc(dev);
+	if (!state) {
+		ret = -ENOMEM;
+		goto out;
 	}
-	drm_modeset_unlock_all(dev);
-}
 
-static void hsw_undo_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
-{
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *crtc =
-		to_intel_crtc(dev_priv->pipe_to_crtc_mapping[PIPE_A]);
-	struct intel_crtc_state *pipe_config;
-
-	drm_modeset_lock_all(dev);
-	/*
-	 * If we use the eDP transcoder we need to make sure that we don't
-	 * bypass the pfit, since otherwise the pipe CRC source won't work. Only
-	 * relevant on hsw with pipe A when using the always-on power well
-	 * routing.
-	 */
-	pipe_config = to_intel_crtc_state(crtc->base.state);
-	if (pipe_config->pch_pfit.force_thru) {
-		bool active = pipe_config->base.active;
-
-		if (active) {
-			intel_crtc_control(&crtc->base, false);
-			pipe_config = to_intel_crtc_state(crtc->base.state);
-		}
-
-		pipe_config->pch_pfit.force_thru = false;
+	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(&crtc->base);
+	pipe_config = intel_atomic_get_crtc_state(state, crtc);
+	if (IS_ERR(pipe_config)) {
+		ret = PTR_ERR(pipe_config);
+		goto out;
+	}
 
-		intel_display_power_put(dev_priv,
-					POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));
+	pipe_config->pch_pfit.force_thru = enable;
+	if (pipe_config->cpu_transcoder == TRANSCODER_EDP &&
+	    pipe_config->pch_pfit.enabled != enable)
+		pipe_config->base.active_changed = true;
 
-		if (active)
-			intel_crtc_control(&crtc->base, true);
-	}
+	ret = drm_atomic_commit(state);
+out:
 	drm_modeset_unlock_all(dev);
+	WARN(ret, "Toggling workaround to %i returns %i\n", enable, ret);
+	if (ret)
+		drm_atomic_state_free(state);
 }
 
 static int ivb_pipe_crc_ctl_reg(struct drm_device *dev,
@@ -3732,7 +3698,7 @@ static int ivb_pipe_crc_ctl_reg(struct drm_device *dev,
 		break;
 	case INTEL_PIPE_CRC_SOURCE_PF:
 		if (IS_HASWELL(dev) && pipe == PIPE_A)
-			hsw_trans_edp_pipe_A_crc_wa(dev);
+			hsw_trans_edp_pipe_A_crc_wa(dev, true);
 
 		*val = PIPE_CRC_ENABLE | PIPE_CRC_SOURCE_PF_IVB;
 		break;
@@ -3844,7 +3810,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
 		else if (IS_VALLEYVIEW(dev))
 			vlv_undo_pipe_scramble_reset(dev, pipe);
 		else if (IS_HASWELL(dev) && pipe == PIPE_A)
-			hsw_undo_trans_edp_pipe_A_crc_wa(dev);
+			hsw_trans_edp_pipe_A_crc_wa(dev, false);
 
 		hsw_enable_ips(crtc);
 	}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 43b0f17ad1fa..7747520bf9f6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12160,6 +12160,7 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
 	struct intel_dpll_hw_state dpll_hw_state;
 	enum intel_dpll_id shared_dpll;
 	uint32_t ddi_pll_sel;
+	bool force_thru;
 
 	/* FIXME: before the switch to atomic started, a new pipe_config was
 	 * kzalloc'd. Code that depends on any field being zero should be
@@ -12171,6 +12172,7 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
 	shared_dpll = crtc_state->shared_dpll;
 	dpll_hw_state = crtc_state->dpll_hw_state;
 	ddi_pll_sel = crtc_state->ddi_pll_sel;
+	force_thru = crtc_state->pch_pfit.force_thru;
 
 	memset(crtc_state, 0, sizeof *crtc_state);
 
@@ -12179,6 +12181,7 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
 	crtc_state->shared_dpll = shared_dpll;
 	crtc_state->dpll_hw_state = dpll_hw_state;
 	crtc_state->ddi_pll_sel = ddi_pll_sel;
+	crtc_state->pch_pfit.force_thru = force_thru;
 }
 
 static int
-- 
2.1.0

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

  reply	other threads:[~2015-07-27 12:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 12:35 [PATCH v2 00/12] DPMS updates and atomic state checking Maarten Lankhorst
2015-07-27 12:35 ` Maarten Lankhorst [this message]
2015-07-27 14:04   ` [PATCH v2 01/12] drm/i915: Make the force_thru workaround atomic Daniel Vetter
2015-07-28  7:57     ` Maarten Lankhorst
2015-07-28  8:25       ` Daniel Vetter
2015-07-28  9:04         ` [PATCH v2.1 01/12] drm/i915: Make the force_thru workaround atomic, v2 Maarten Lankhorst
2015-07-27 12:35 ` [PATCH v2 02/12] drm/i915: Update atomic state when removing mst connector Maarten Lankhorst
2015-07-28 12:13   ` Ander Conselvan De Oliveira
2015-08-03  8:10     ` [PATCH v2.1 2.7/12] drm/i915: Update atomic state when removing mst connector, v2 Maarten Lankhorst
2015-08-06  5:34   ` [PATCH v2 02/12] drm/i915: Update atomic state when removing mst connector Sivakumar Thulasimani
2015-08-06  7:28     ` Maarten Lankhorst
2015-07-27 12:35 ` [PATCH v2 03/12] drm/i915: Convert connector checking to atomic Maarten Lankhorst
2015-07-28 13:13   ` Ander Conselvan De Oliveira
2015-07-28 15:51     ` Maarten Lankhorst
2015-07-30 12:57     ` [PATCH v2.1 2.5/12] drm/i915: Validate the state after an atomic modeset, only, and pass the state Maarten Lankhorst
2015-07-31  9:32       ` Ander Conselvan De Oliveira
2015-07-30 12:57     ` [PATCH v2.1 03/12] drm/i915: Convert connector checking to atomic, v2 Maarten Lankhorst
2015-07-31  9:37       ` Ander Conselvan De Oliveira
2015-07-27 12:35 ` [PATCH v2 04/12] drm/i915: Remove some unneeded checks from check_crtc_state Maarten Lankhorst
2015-07-28 13:29   ` Ander Conselvan De Oliveira
2015-07-27 12:35 ` [PATCH v2 05/12] drm/i915: Remove connectors_active from state checking Maarten Lankhorst
2015-07-28 13:48   ` Ander Conselvan De Oliveira
2015-07-27 12:35 ` [PATCH v2 06/12] drm/i915: Make crtc checking use the atomic state Maarten Lankhorst
2015-07-29 11:49   ` Ander Conselvan De Oliveira
2015-07-29 12:04     ` Daniel Vetter
2015-07-29 12:31       ` Ander Conselvan De Oliveira
2015-07-29 12:44         ` Maarten Lankhorst
2015-07-30 12:59         ` [PATCH v2.1 06/12] drm/i915: Make crtc checking use the atomic state, v2 Maarten Lankhorst
2015-07-27 12:35 ` [PATCH v2 07/12] drm/i915: Get rid of dpms handling Maarten Lankhorst
2015-07-31  9:40   ` Ander Conselvan De Oliveira
2015-07-27 12:35 ` [PATCH v2 08/12] drm/i915: Remove connectors_active from sanitization Maarten Lankhorst
2015-07-29 13:09   ` Ander Conselvan De Oliveira
2015-07-30  7:11     ` Maarten Lankhorst
2015-07-30 13:00     ` [PATCH v2.1 08/12] drm/i915: Remove connectors_active from sanitization, v2 Maarten Lankhorst
2015-07-27 12:35 ` [PATCH v2 09/12] drm/i915: Remove connectors_active from intel_dp.c Maarten Lankhorst
2015-07-29 13:26   ` Ander Conselvan De Oliveira
2015-07-30  6:54     ` Maarten Lankhorst
2015-07-30  9:16       ` Ander Conselvan De Oliveira
2015-07-30 13:01         ` [PATCH v2.1 09/12] drm/i915: Remove connectors_active from intel_dp.c, v2 Maarten Lankhorst
2015-07-27 12:35 ` [PATCH v2 10/12] drm/i915: Remove connectors_active Maarten Lankhorst
2015-07-31  9:41   ` Ander Conselvan De Oliveira
2015-07-27 12:35 ` [PATCH v2 11/12] drm/i915: Only update mode related state if a modeset happened Maarten Lankhorst
2015-07-30 12:19   ` Ander Conselvan De Oliveira
2015-07-27 12:35 ` [PATCH v2 12/12] drm/i915: Handle return value in intel_pin_and_fence_fb_obj, v2 Maarten Lankhorst
2015-07-28  8:39   ` shuang.he

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=1438000541-3219-2-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.