Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 02/10] drm/i915: fix FDI lane calculation
Date: Tue, 20 Nov 2012 13:27:36 -0200	[thread overview]
Message-ID: <1353425264-3728-3-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1353425264-3728-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

The previous code was making the bps value 5% higher than what the
spec says, which was enough to make certain VGA modes require 3 lanes
instead of 2, which breaks Haswell since it only has 2 FDI lanes. For
previous gens this was not a problem, since requiring more lanes than
the needed is ok, as long as you have all the lanes.

Notice that this might improve the case where we use pipes B and C on
Ivy Bridge since both pipes only have 4 lanes to share (see
ironlake_check_fdi_lanes).

We still need to code to refuse modes requiring more than 2 lanes on
Haswell.

Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0102931..9940765 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5272,14 +5272,15 @@ static void ironlake_set_m_n(struct drm_crtc *crtc,
 
 	if (!lane) {
 		/*
-		 * Account for spread spectrum to avoid
-		 * oversubscribing the link. Max center spread
-		 * is 2.5%; use 5% for safety's sake.
+		 * The spec says:
+		 * Number of lanes >= INT(dot clock * bytes per pixel / ls_clk)
 		 */
-		u32 bps = target_clock * intel_crtc->bpp * 21 / 20;
-		lane = bps / (link_bw * 8) + 1;
+		u32 bps = target_clock * intel_crtc->bpp;
+		lane = DIV_ROUND_UP(bps, (link_bw * 8));
 	}
 
+	DRM_DEBUG_KMS("Using %d FDI lanes on pipe %c\n", lane,
+		      pipe_name(intel_crtc->pipe));
 	intel_crtc->fdi_lanes = lane;
 
 	if (pixel_multiplier > 1)
-- 
1.7.11.7

  parent reply	other threads:[~2012-11-20 15:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 15:27 [PATCH 00/10] Random Haswell fixes Paulo Zanoni
2012-11-20 15:27 ` [PATCH 01/10] drm/i915: don't limit Haswell CRT encoder to pipe A Paulo Zanoni
2012-11-20 18:20   ` Damien Lespiau
2012-11-20 15:27 ` Paulo Zanoni [this message]
2012-11-20 18:17   ` [PATCH 02/10] drm/i915: fix FDI lane calculation Damien Lespiau
2012-11-20 18:43     ` Paulo Zanoni
2012-11-20 15:27 ` [PATCH 03/10] drm/i915: use cpu/pch transcoder on intel_enable_pipe Paulo Zanoni
2012-11-20 18:23   ` Damien Lespiau
2012-11-20 15:27 ` [PATCH 04/10] drm/i915: fix false positive "Unclaimed write" messages Paulo Zanoni
2012-11-20 18:46   ` Damien Lespiau
2012-11-20 19:10     ` Paulo Zanoni
2012-11-20 19:24       ` Damien Lespiau
2012-11-20 19:34         ` Paulo Zanoni
2012-11-20 15:27 ` [PATCH 05/10] drm/i915: make DP work on LPT-LP machines Paulo Zanoni
2012-11-20 16:50   ` Daniel Vetter
2012-11-20 17:12   ` Paulo Zanoni
2012-11-20 19:00     ` Damien Lespiau
2012-11-20 19:14       ` Paulo Zanoni
2012-11-20 15:27 ` [PATCH 06/10] drm/i915: don't intel_crt_init if DDI A has 4 lanes Paulo Zanoni
2012-11-20 19:12   ` Damien Lespiau
2012-11-20 15:27 ` [PATCH 07/10] drm/i915: make the panel fitter work on pipes B and C on IVB Paulo Zanoni
2012-11-20 19:34   ` Damien Lespiau
2012-11-20 15:27 ` [PATCH 08/10] drm/i915: make the panel fitter work on pipes B and C on Haswell Paulo Zanoni
2012-11-20 19:35   ` Damien Lespiau
2012-11-20 15:27 ` [PATCH 09/10] drm/i915: fix intel_ddi_get_cdclk_freq for ULT machines Paulo Zanoni
2012-11-20 19:59   ` Damien Lespiau
2012-11-20 15:27 ` [PATCH 10/10] drm/i915: implement WaMbcDriverBootEnable on Haswell Paulo Zanoni
2012-11-21 13:31   ` 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=1353425264-3728-3-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox