[PATCH 2/2] UBUNTU: SAUCE: i915_bpo: Validate mode against max. link data rate for DP MST
Timo Aaltonen
tjaalton at ubuntu.com
Wed Jan 18 08:18:15 UTC 2017
From: Timo Aaltonen <timo.aaltonen at canonical.com>
BugLink: http://bugs.launchpad.net/bugs/1657353
Not validating the mode rate against max. link rate results in not pruning
invalid modes. For e.g, a HBR2 5.4 Gbps 2-lane configuration does not
support 4k at 60Hz. But, we do not reject this mode.
So, make use of the helpers in intel_dp to validate mode data rate against
max. link data rate of a configuration.
v3: Renamed local variables again for consistency (Manasi)
v2: Renamed mode data rate local variable to be more explanatory.
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1479243546-17189-1-git-send-email-dhinakaran.pandiyan@intel.com
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
(backported from drm-intel-next commit 22a2c8e0457f5d66db0819a49beb8c119d8f7a97)
Signed-off-by: Timo Aaltonen <timo.aaltonen at canonical.com>
---
ubuntu/i915/intel_dp.c | 4 ++--
ubuntu/i915/intel_dp_mst.c | 12 +++++++++++-
ubuntu/i915/intel_drv.h | 3 +++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/ubuntu/i915/intel_dp.c b/ubuntu/i915/intel_dp.c
index 53772f2..92320f6 100644
--- a/ubuntu/i915/intel_dp.c
+++ b/ubuntu/i915/intel_dp.c
@@ -166,14 +166,14 @@ static u8 intel_dp_max_lane_count(struct intel_dp *intel_dp)
return min(source_max, sink_max);
}
-static int
+int
intel_dp_link_required(int pixel_clock, int bpp)
{
/* pixel_clock is in kHz, divide bpp by 8 for bit to Byte conversion */
return DIV_ROUND_UP(pixel_clock * bpp, 8);
}
-static int
+int
intel_dp_max_data_rate(int max_link_clock, int max_lanes)
{
/* max_link_clock is the link symbol clock (LS_Clk) in kHz and not the
diff --git a/ubuntu/i915/intel_dp_mst.c b/ubuntu/i915/intel_dp_mst.c
index 6e03468..9d41990 100644
--- a/ubuntu/i915/intel_dp_mst.c
+++ b/ubuntu/i915/intel_dp_mst.c
@@ -345,7 +345,17 @@ static enum drm_mode_status
intel_dp_mst_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
+ struct intel_connector *intel_connector = to_intel_connector(connector);
+ struct intel_dp *intel_dp = intel_connector->mst_port;
int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
+ int bpp = 24; /* MST uses fixed bpp */
+ int max_rate, mode_rate, max_lanes, max_link_clock;
+
+ max_link_clock = intel_dp_max_link_rate(intel_dp);
+ max_lanes = drm_dp_max_lane_count(intel_dp->dpcd);
+
+ max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
+ mode_rate = intel_dp_link_required(mode->clock, bpp);
/* TODO - validate mode against available PBN for link */
if (mode->clock < 10000)
@@ -354,7 +364,7 @@ intel_dp_mst_mode_valid(struct drm_connector *connector,
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
return MODE_H_ILLEGAL;
- if (mode->clock > max_dotclk)
+ if (mode_rate > max_rate || mode->clock > max_dotclk)
return MODE_CLOCK_HIGH;
return MODE_OK;
diff --git a/ubuntu/i915/intel_drv.h b/ubuntu/i915/intel_drv.h
index 8c5a158..687eb82 100644
--- a/ubuntu/i915/intel_drv.h
+++ b/ubuntu/i915/intel_drv.h
@@ -1338,6 +1338,9 @@ bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
bool
intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]);
+int intel_dp_link_required(int pixel_clock, int bpp);
+int intel_dp_max_data_rate(int max_link_clock, int max_lanes);
+
/* intel_dp_mst.c */
int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
--
2.7.4
More information about the kernel-team
mailing list