intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lee Shawn C <shawn.c.lee@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Cooper Chiou <cooper.chiou@intel.com>, Sam McNally <sammc@google.com>
Subject: [Intel-gfx] [PATCH] drm/i915: Check require bandwidth did not exceed LSPCON limitation
Date: Wed,  5 Feb 2020 22:38:54 +0800	[thread overview]
Message-ID: <20200205143854.10557-1-shawn.c.lee@intel.com> (raw)

While mode setting, driver would calculate mode rate based on
resolution and bpp. And choose the best bpp that did not exceed
DP bandwidtd.

But LSPCON had more restriction due to it convert DP to HDMI.
Driver should respect HDMI's bandwidth limitation if LSPCON
was active. This change would ignore the bpp when its required
output bandwidth already over HDMI 2.0 or 1.4 spec.

Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>
Cc: Sam McNally <sammc@google.com>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c     | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_lspcon.c | 10 ++++++++++
 drivers/gpu/drm/i915/display/intel_lspcon.h |  1 +
 3 files changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 2057f63e32f0..64969ae1c285 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -1992,6 +1992,9 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
 				  const struct link_config_limits *limits)
 {
 	struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode;
+	struct intel_connector *connector = intel_dp->attached_connector;
+	const struct drm_display_info *info = &connector->base.display_info;
+	struct intel_lspcon *lspcon = dp_to_lspcon(intel_dp);
 	int bpp, clock, lane_count;
 	int mode_rate, link_clock, link_avail;
 
@@ -2001,6 +2004,21 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
 		mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
 						   output_bpp);
 
+		/*
+		 * Bypass this mode if require bandwidth over downstream
+		 * limitation or HDMI spec when LSPCON active.
+		 */
+		if (lspcon->active) {
+			int max_clock_rate = lspcon_max_rate(lspcon);
+
+			if (info->max_tmds_clock)
+				max_clock_rate = min(max_clock_rate,
+						     info->max_tmds_clock);
+
+			if (mode_rate > max_clock_rate)
+				continue;
+		}
+
 		for (clock = limits->min_clock; clock <= limits->max_clock; clock++) {
 			for (lane_count = limits->min_lane_count;
 			     lane_count <= limits->max_lane_count;
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index d807c5648c87..3b0438356a88 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -518,6 +518,16 @@ void lspcon_set_infoframes(struct intel_encoder *encoder,
 				  buf, ret);
 }
 
+int lspcon_max_rate(struct intel_lspcon *lspcon)
+{
+	enum drm_lspcon_mode current_mode = lspcon_get_current_mode(lspcon);
+
+	if (current_mode == DRM_LSPCON_MODE_LS)
+		return DIV_ROUND_UP(340000 * 24, 8);
+
+	return DIV_ROUND_UP(600000 * 24, 8);
+}
+
 u32 lspcon_infoframes_enabled(struct intel_encoder *encoder,
 			      const struct intel_crtc_state *pipe_config)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
index 37cfddf8a9c5..b584c02ab33b 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.h
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
@@ -18,6 +18,7 @@ struct intel_lspcon;
 bool lspcon_init(struct intel_digital_port *intel_dig_port);
 void lspcon_resume(struct intel_lspcon *lspcon);
 void lspcon_wait_pcon_mode(struct intel_lspcon *lspcon);
+int lspcon_max_rate(struct intel_lspcon *lspcon);
 void lspcon_write_infoframe(struct intel_encoder *encoder,
 			    const struct intel_crtc_state *crtc_state,
 			    unsigned int type,
-- 
2.17.1

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

             reply	other threads:[~2020-02-05  6:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 14:38 Lee Shawn C [this message]
2020-02-05  7:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Check require bandwidth did not exceed LSPCON limitation (rev6) Patchwork
2020-02-05  9:29 ` [Intel-gfx] [PATCH] drm/i915: Check require bandwidth did not exceed LSPCON limitation Lee, Shawn C
2020-02-07 14:06 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Check require bandwidth did not exceed LSPCON limitation (rev6) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2020-01-17 13:47 [Intel-gfx] [PATCH] drm/i915: Check require bandwidth did not exceed LSPCON limitation Lee Shawn C
2020-01-17  6:56 ` Jani Nikula
2020-01-17  7:15   ` Lee, Shawn C
2020-01-17 14:04 ` Ville Syrjälä
2020-01-17 16:08   ` Lee, Shawn C

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=20200205143854.10557-1-shawn.c.lee@intel.com \
    --to=shawn.c.lee@intel.com \
    --cc=cooper.chiou@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sammc@google.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;
as well as URLs for NNTP newsgroup(s).