Intel-GFX Archive on 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>
Subject: [PATCH 04/10] drm/i915: use wait_for_vblank instead of msleep(17)
Date: Thu, 29 Nov 2012 15:59:33 +0100	[thread overview]
Message-ID: <1354201179-14975-4-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1354201179-14975-1-git-send-email-daniel.vetter@ffwll.ch>

17 ms is eerily close to 60 Hz ^-1

Unfortunately this goes back to the original DP enabling for ilk, and
unfortunately does not come with a reason for it's existance attached.

Some closer inspection of the code and DP specs shows that we set the
idle link pattern before we disable the port. And it seems like that
the DP spec (or at least our hw) only switch to the idle pattern on
the next vblank. Hence a vblank wait at this spot makes _much_ more
sense than a really long wait.

v2: Rebase fixup.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_dp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index ee03a45..b3754b0 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1993,6 +1993,8 @@ intel_dp_link_down(struct intel_dp *intel_dp)
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = intel_dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc =
+		to_intel_crtc(intel_dig_port->base.base.crtc);
 	uint32_t DP = intel_dp->DP;
 
 	/*
@@ -2027,7 +2029,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
 	}
 	POSTING_READ(intel_dp->output_reg);
 
-	msleep(17);
+	intel_wait_for_vblank(dev, intel_crtc->pipe);
 
 	if (HAS_PCH_IBX(dev) &&
 	    I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {
@@ -2059,7 +2061,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
 			POSTING_READ(intel_dp->output_reg);
 			msleep(50);
 		} else
-			intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);
+			intel_wait_for_vblank(dev, intel_crtc->pipe);
 	}
 
 	DP &= ~DP_AUDIO_OUTPUT_ENABLE;
-- 
1.7.11.7

  parent reply	other threads:[~2012-11-29 15:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 14:59 [PATCH 01/10] drm/i915: rip out pre-DDI stuff from haswell_crtc_mode_set Daniel Vetter
2012-11-29 14:59 ` [PATCH 02/10] drm/i915: move set_pll_edp to intel_dp.c Daniel Vetter
2012-11-29 14:59 ` [PATCH 03/10] drm/i915: rip out pre-production ilk cpu edp w/a Daniel Vetter
2012-11-29 14:59 ` Daniel Vetter [this message]
2012-11-29 14:59 ` [PATCH 05/10] drm/i915: WARN on !crtc in intel_dp_link_down Daniel Vetter
2012-11-29 14:59 ` [PATCH 06/10] drm/i915: drop unnecessary clearing of pch dp transcoder timings Daniel Vetter
2012-12-03 15:45   ` Paulo Zanoni
2012-11-29 14:59 ` [PATCH 07/10] drm/i915: extract common link_m_n helpers Daniel Vetter
2012-12-03 15:33   ` Paulo Zanoni
2012-12-06 13:33     ` Daniel Vetter
2012-11-29 14:59 ` [PATCH 08/10] drm/i915: don't call update_watermark in crtc_mode_set Daniel Vetter
2012-11-29 14:59 ` [PATCH 09/10] drm/i915: don't call update_watermarks from haswell enable/disable code Daniel Vetter
2012-11-29 14:59 ` [PATCH 10/10] drm/i915: rip out update_linetime_wm abstraction Daniel Vetter
2012-12-04 17:34   ` Paulo Zanoni
2012-12-05 11:03     ` Daniel Vetter
2012-12-03 15:03 ` [PATCH 01/10] drm/i915: rip out pre-DDI stuff from haswell_crtc_mode_set Paulo Zanoni
2012-12-03 16:42   ` Daniel Vetter
2012-12-06 13:25     ` 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=1354201179-14975-4-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox