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 6/6] drm/i915: fix up adjusted_mode tracking for interlaced modes
Date: Fri,  3 May 2013 11:49:51 +0200	[thread overview]
Message-ID: <1367574591-1714-6-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1367574591-1714-1-git-send-email-daniel.vetter@ffwll.ch>

With the hw state readout&check code it's important that the values we
keep around are the canonical ones. Unfortunately when adding the pipe
timings readout support I've missed that the write side adjusts the
timings in the pipe config.

Fix this up.

Reported-by: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9ae60c2..3b7fae1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4729,12 +4729,17 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum pipe pipe = intel_crtc->pipe;
 	enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder;
-	uint32_t vsyncshift;
+	uint32_t vsyncshift, crtc_vtotal, crtc_vblank_end;
+
+	/* We need to be careful not to changed the adjusted mode, for otherwise
+	 * the hw state checker will get angry at the mismatch. */
+	crtc_vtotal = adjusted_mode->crtc_vtotal;
+	crtc_vblank_end = adjusted_mode->crtc_vblank_end;
 
 	if (!IS_GEN2(dev) && adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
 		/* the chip adds 2 halflines automatically */
-		adjusted_mode->crtc_vtotal -= 1;
-		adjusted_mode->crtc_vblank_end -= 1;
+		crtc_vtotal -= 1;
+		crtc_vblank_end -= 1;
 		vsyncshift = adjusted_mode->crtc_hsync_start
 			     - adjusted_mode->crtc_htotal / 2;
 	} else {
@@ -4756,10 +4761,10 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc,
 
 	I915_WRITE(VTOTAL(cpu_transcoder),
 		   (adjusted_mode->crtc_vdisplay - 1) |
-		   ((adjusted_mode->crtc_vtotal - 1) << 16));
+		   ((crtc_vtotal - 1) << 16));
 	I915_WRITE(VBLANK(cpu_transcoder),
 		   (adjusted_mode->crtc_vblank_start - 1) |
-		   ((adjusted_mode->crtc_vblank_end - 1) << 16));
+		   ((crtc_vblank_end - 1) << 16));
 	I915_WRITE(VSYNC(cpu_transcoder),
 		   (adjusted_mode->crtc_vsync_start - 1) |
 		   ((adjusted_mode->crtc_vsync_end - 1) << 16));
-- 
1.8.1.4

  parent reply	other threads:[~2013-05-03  9:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 16:03 [PATCH 1/5] drm/i915: s/TRANSCONF/PCH_TRANSCONF/ Daniel Vetter
2013-05-01 16:03 ` [PATCH 2/5] drm/i915: PCH_ prefix for transcoder timings Daniel Vetter
2013-05-02 18:39   ` Paulo Zanoni
2013-05-01 16:03 ` [PATCH 3/5] drm/i915: make set_m_n functions static Daniel Vetter
2013-05-02 18:45   ` Paulo Zanoni
2013-05-01 16:03 ` [PATCH 4/5] drm/i915: Apply OCD to data/link m/n register #defines Daniel Vetter
2013-05-02 20:36   ` Paulo Zanoni
2013-05-03  9:15     ` Daniel Vetter
2013-05-01 16:03 ` [PATCH 5/5] drm/i915: make intel_cpt_verify_modeset static Daniel Vetter
2013-05-02 20:40   ` Paulo Zanoni
2013-05-02 18:12 ` [PATCH 1/5] drm/i915: s/TRANSCONF/PCH_TRANSCONF/ Paulo Zanoni
2013-05-03  9:19   ` Daniel Vetter
2013-05-03  9:49     ` [PATCH 1/6] " Daniel Vetter
2013-05-03  9:49       ` [PATCH 2/6] drm/i915: PCH_ prefix for transcoder timings Daniel Vetter
2013-05-03 14:16         ` Paulo Zanoni
2013-05-06  9:29           ` Daniel Vetter
2013-05-03  9:49       ` [PATCH 3/6] drm/i915: make set_m_n functions static Daniel Vetter
2013-05-03  9:49       ` [PATCH 4/6] drm/i915: Apply OCD to data/link m/n register #defines Daniel Vetter
2013-05-03  9:49       ` [PATCH 5/6] drm/i915: make intel_cpt_verify_modeset static Daniel Vetter
2013-05-03  9:49       ` Daniel Vetter [this message]
2013-05-03 11:24         ` [PATCH 6/6] drm/i915: fix up adjusted_mode tracking for interlaced modes Daniel Vetter
2013-05-03 14:31           ` Paulo Zanoni
2013-05-06  9:24             ` 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=1367574591-1714-6-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