All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Mika Kuoppala <mika.kuoppala@intel.com>,
	Hans de Bruin <jmdebruin@xmsnet.nl>
Subject: [PATCH 3/7] drm/i915: Fixup pfit disabling for gen2/3
Date: Thu, 11 Apr 2013 16:29:06 +0200	[thread overview]
Message-ID: <1365690550-5716-3-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1365690550-5716-1-git-send-email-daniel.vetter@ffwll.ch>

The recent rework of the pfit handling didn't take into account that
the panel fitter is fixed to pipe B:

commit 24a1f16de97c4cf0029d9acd04be06db32208726
Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Date:   Fri Feb 8 16:35:37 2013 +0200

    drm/i915: disable shared panel fitter for pipe

Fix this up by properly computing the pipe the pfit is on. Also
extract the logic into its own function, add a debug assert to check
that the pipe is off (mostly just documentation) and add some debug
output.

If pipe A was disabled after pipe B was set up, the panel fitter will
be disabled. Now most userspace doesn't do modesets in this order,
which is why I couldn't ever reproduce this and why it took me so long
to figure out.

We really need hw state readout and check support for the pannel
fitter ...

Reported-by: Hans de Bruin <jmdebruin@xmsnet.nl>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Hans de Bruin <jmdebruin@xmsnet.nl>
References: http://permalink.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/19049
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 58c6bb6..38b8a77 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3623,6 +3623,26 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 		encoder->enable(encoder);
 }
 
+static void i9xx_pfit_disable(struct intel_crtc *crtc)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum pipe pipe;
+	uint32_t pctl = I915_READ(PFIT_CONTROL);
+
+	assert_pipe_disabled(dev_priv, crtc->pipe);
+
+	if (INTEL_INFO(dev)->gen >= 4)
+		pipe = (pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT;
+	else
+		pipe = PIPE_B;
+
+	if (pipe == crtc->pipe) {
+		DRM_DEBUG_DRIVER("disabling pfit, current: 0x%08x\n", pctl);
+		I915_WRITE(PFIT_CONTROL, 0);
+	}
+}
+
 static void i9xx_crtc_disable(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
@@ -3631,8 +3651,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	struct intel_encoder *encoder;
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
-	u32 pctl;
-
 
 	if (!intel_crtc->active)
 		return;
@@ -3652,11 +3670,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	intel_disable_plane(dev_priv, plane, pipe);
 	intel_disable_pipe(dev_priv, pipe);
 
-	/* Disable pannel fitter if it is on this pipe. */
-	pctl = I915_READ(PFIT_CONTROL);
-	if ((pctl & PFIT_ENABLE) &&
-	    ((pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT) == pipe)
-		I915_WRITE(PFIT_CONTROL, 0);
+	i9xx_pfit_disable(intel_crtc);
 
 	intel_disable_pll(dev_priv, pipe);
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-04-11 14:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 14:29 [PATCH 1/7] drm/i915: move debug output back to the right place Daniel Vetter
2013-04-11 14:29 ` [PATCH 2/7] drm/i915: Fixup Oops in the pipe config computation Daniel Vetter
2013-04-11 21:09   ` Daniel Vetter
2013-04-12  8:10     ` Daniel Vetter
2013-04-12  9:46   ` Chris Wilson
2013-04-12 15:24     ` Daniel Vetter
2013-04-12 16:48       ` [PATCH] " Daniel Vetter
2013-04-12 17:46         ` Chris Wilson
2013-04-11 14:29 ` Daniel Vetter [this message]
2013-04-12 14:01   ` [PATCH 3/7] drm/i915: Fixup pfit disabling for gen2/3 Chris Wilson
2013-04-11 14:29 ` [PATCH 4/7] drm/i915: don't enable the plane too early in i9xx_crtc_mode_set Daniel Vetter
2013-04-12 14:05   ` Chris Wilson
2013-04-11 14:29 ` [PATCH 5/7] drm/i915: drop redundant vblank waits Daniel Vetter
2013-04-11 17:47   ` Paulo Zanoni
2013-04-11 18:10     ` Daniel Vetter
2013-04-12 14:03   ` Chris Wilson
2013-04-11 14:29 ` [PATCH 6/7] drm/i915: add pipe asserts for the crtc enable sequence Daniel Vetter
2013-04-12 14:03   ` Chris Wilson
2013-04-11 14:29 ` [PATCH 7/7] drm/i915: add i9xx pfit pipe asserts Daniel Vetter
2013-04-11 16:37   ` Ville Syrjälä
2013-04-11 16:38     ` Daniel Vetter
2013-04-12  5:47     ` Jani Nikula
2013-04-12 14:02   ` Chris Wilson
2013-04-15  8:17     ` Daniel Vetter
2013-04-11 14:39 ` [PATCH] drm/i915: move debug output back to the right place Daniel Vetter
2013-04-11 17:27   ` Ville Syrjälä
2013-04-11 17:49     ` 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=1365690550-5716-3-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jmdebruin@xmsnet.nl \
    --cc=mika.kuoppala@intel.com \
    /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.