Enable Upfront Link Training on DDI platforms
Subsystems (2)
Re: [PATCH 11/14] drm/i915: Fallback to lower link rate and lane count during link training
In reply to Pandiyan, DhinakaranQuoted 169 lines · Dhinakaran
Quoted 148 lines · Manasi Navare
According to the DisplayPort Spec, in case of Clock Recovery failure the link training sequence should fall back to the lower link rate followed by lower lane count until CR succeeds.
On CR success, the sequence proceeds with Channel EQ.
In case of Channel EQ failures, it should fallback to lower link rate and lane count and start the CR phase again.Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 109 +++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 4 +- 3 files changed, 110 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +75
-11@@ -1634,29 +1634,50 @@ void intel_ddi_clk_select(struct intel_encoder *encoder, } } -static void intel_ddi_pre_enable_dp (struct intel_encoder *encoder, +static void intel_ddi_pre_enable_edp (struct intel_encoder *encoder,int link_rate,uint32_t lane_count, -struct intel_shared_dpll *pll, -bool link_mst) +struct intel_shared_dpll *pll) {struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);enum port port =intel_ddi_get_encoder_port (encoder);intel_dp_set_link_params (intel_dp, link_rate, lane_count, - link_mst); -if (encoder->type ==INTEL_OUTPUT_EDP ) -intel_edp_panel_on (intel_dp); + false); + +intel_edp_panel_on (intel_dp);intel_ddi_clk_select (encoder, pll);intel_prepare_dp_ddi_buffers (encoder);intel_ddi_init_dp_buf_reg (encoder);intel_dp_sink_dpms (intel_dp,DRM_MODE_DPMS_ON );intel_dp_start_link_train (intel_dp); -if (port !=PORT_A ||INTEL_GEN (dev_priv) >=9 ) +if (port !=PORT_A ||INTEL_INFO (dev_priv)->gen >=9 )intel_dp_stop_link_train (intel_dp); } +static void intel_ddi_pre_enable_dp (struct intel_encoder *encoder, +int link_rate,uint32_t lane_count, +struct intel_shared_dpll *pll, +bool link_mst) +{ +struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_shared_dpll_config tmp_pll_config; + +/* Disable the PLL and obtain the PLL for Link Training +* that starts with highest link rate and lane count. +*/ + tmp_pll_config = pll->config; + pll->funcs.disable (dev_priv, pll); + pll->config.crtc_mask =0 ; + +/* If Link Training fails, send a uevent to generate a hotplug */ +if (!(intel_ddi_link_train (intel_dp, link_rate, lane_count, link_mst))) +drm_kms_helper_hotplug_event (encoder->base.dev); + pll->config = tmp_pll_config; +} + static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder, bool has_hdmi_sink, struct drm_display_mode *adjusted_mode,@@ -1690,20 +1711,26 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder,struct intel_crtc *crtc =to_intel_crtc (encoder->crtc);int type = intel_encoder->type; -if (type ==INTEL_OUTPUT_DP || type ==INTEL_OUTPUT_EDP ) { +if (type ==INTEL_OUTPUT_EDP ) +intel_ddi_pre_enable_edp (intel_encoder, + crtc->config->port_clock, + crtc->config->lane_count, + crtc->config->shared_dpll); + +if (type ==INTEL_OUTPUT_DP )intel_ddi_pre_enable_dp (intel_encoder, crtc->config->port_clock, crtc->config->lane_count, crtc->config->shared_dpll,intel_crtc_has_type (crtc->config,INTEL_OUTPUT_DP_MST )); - } -if (type ==INTEL_OUTPUT_HDMI ) { + +if (type ==INTEL_OUTPUT_HDMI )intel_ddi_pre_enable_hdmi (intel_encoder, crtc->config->has_hdmi_sink, &crtc->config->base.adjusted_mode, crtc->config->shared_dpll); - } + } static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,@@ -2431,6 +2458,66 @@ intel_ddi_get_link_dpll(struct intel_dp *intel_dp, int clock)return pll; } +bool +intel_ddi_link_train (struct intel_dp *intel_dp,int max_link_rate, +uint8_t max_lane_count,bool link_mst) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_shared_dpll *pll; +struct intel_shared_dpll_config tmp_pll_config; +int link_rate; +uint8_t lane_count; +bool link_rate_not_found = true; +bool ret = false; + +for (lane_count = max_lane_count; lane_count >0 ; lane_count >>=1 ) { + + link_rate = max_link_rate; +while (link_rate_not_found) { + pll =intel_ddi_get_link_dpll (intel_dp, link_rate); +if (pll ==NULL ) { +DRM_ERROR ("Could not find DPLL for link " +"training.\n" ); +return false; + } + tmp_pll_config = pll->config; + pll->funcs.enable (dev_priv, pll); + +intel_dp_set_link_params (intel_dp, link_rate, + lane_count, link_mst); + +intel_ddi_clk_select (encoder, pll); +intel_prepare_dp_ddi_buffers (encoder); +intel_ddi_init_dp_buf_reg (encoder); +intel_dp_sink_dpms (intel_dp,DRM_MODE_DPMS_ON ); + ret =intel_dp_start_link_train (intel_dp); +if (ret) +break ;drivers/gpu/drm/i915/intel_ddi.c intel_ddi_get_link_dpll(struct intel_dp *intel_dp, int clock) · line 2507
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+ +/* Disable port followed by PLL for next retry/clean up */ +intel_ddi_post_disable (encoder,NULL ,NULL ); + pll->funcs.disable (dev_priv, pll); +if (link_rate ==540000 ) + link_rate =270000 ; +else if (link_rate ==270000 ) + link_rate =162000 ; +else + link_rate_not_found = false;1. Aren't the supported rates platform dependent? I see these definitions in
intel_dp.cstatic const int bxt_rates[] = { 162000, 216000, 243000, 270000,
324000, 432000, 540000 }; static const int skl_rates[] = { 162000, 216000, 270000, 324000, 432000, 540000 };
Quoted 5 lines
2. Also, it is good to have the standard rates defined in a array within a header instead of having literals here.
Or even better, re-use what's available in
intel_dp.cstatic const int default_rates[] = { 162000, 270000, 540000 };
Actually, we should be fetching and using the common rates here. There's already code to take the union of what the source and sink support.
Jim
Quoted 59 lines
Quoted 59 lines
drivers/gpu/drm/i915/intel_ddi.c +13
-0+ } +if (ret) { +DRM_DEBUG_KMS ("Link Training successful\n" ); +intel_dp_stop_link_train (intel_dp); +break ; + } + } +if (!lane_count) +DRM_ERROR ("Link Training Failed\n" ); + +return ret; +} +void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv =to_i915 (dev);drivers/gpu/drm/i915/intel_dp_link_training.c +9
-3@@ -309,9 +309,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp) DP_TRAINING_PATTERN_DISABLE); } -void +bool intel_dp_start_link_train (struct intel_dp *intel_dp) { -intel_dp_link_training_clock_recovery (intel_dp); -intel_dp_link_training_channel_equalization (intel_dp); +bool ret; + +if (intel_dp_link_training_clock_recovery (intel_dp)) { + ret =intel_dp_link_training_channel_equalization (intel_dp); +if (ret) +return true; + } +return false; }drivers/gpu/drm/i915/intel_drv.h +3
-1@@ -1160,6 +1160,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); +bool intel_ddi_link_train (struct intel_dp *intel_dp,int max_link_rate, +uint8_t max_lane_count,bool link_mst);struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock); unsigned int intel_fb_align_height(struct drm_device *dev,@@ -1381,7 +1383,7 @@ bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,void intel_dp_set_link_params (struct intel_dp *intel_dp,int link_rate,uint8_t lane_count,bool link_mst); -void intel_dp_start_link_train (struct intel_dp *intel_dp); +bool intel_dp_start_link_train (struct intel_dp *intel_dp);
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · line 1389
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0void intel_dp_stop_link_train (struct intel_dp *intel_dp);void intel_dp_sink_dpms (struct intel_dp *intel_dp,int mode);void intel_dp_encoder_reset (struct drm_encoder *encoder);_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/14 drm/i915: Reverse the loop in intel_dp_compute_config
In reply to Manasi NavareWhile configuring the pipe during modeset, it should loop starting from max clock and max lane count reducing the lane count and clock in each iteration until the requested mode rate is less than or equal to available link BW.
--- drivers/gpu/drm/i915/intel_dp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -5
@@ -1552,11 +1552,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,for (; bpp >=6 *3 ; bpp -=2 *3 ) { mode_rate =intel_dp_link_required (adjusted_mode->crtc_clock, bpp); - -for (clock = min_clock; clock <= max_clock; clock++) { -for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { +for (clock = max_clock; clock >= max_clock; clock--) { +for (lane_count = max_lane_count; + lane_count >= min_lane_count; + lane_count >>=1 ) { link_clock = common_rates[clock]; link_avail = intel_dp_max_data_rate(link_clock,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/14] drm/i915: Reverse the loop in intel_dp_compute_config
Quoted 24 lines · Manasi Navare
While configuring the pipe during modeset, it should loop starting from max clock and max lane count reducing the lane count and clock in each iteration until the requested mode rate is less than or equal to available link BW.
Signed-off-by Manasi Navare <[email protected]>---
drivers/gpu/drm/i915/intel_dp.c | 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -1552,11 +1552,10 @@ intel_dp_compute_config(struct intel_encoder *encoder, for (; bpp >= 6*3; bpp -= 2*3) {
mode_rate= intel_dp_link_required(adjusted_mode-Quoted 1 line
crtc_clock,bpp);
drivers/gpu/drm/i915/intel_dp.c +0
-2- -for (clock = min_clock; clock <= max_clock; clock++){
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder,
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1
-3-for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { +for (clock = max_clock; clock >= max_clock; clock--)
The clock should be higher than or equal to min_clock.
Quoted 8 lines
{
drivers/gpu/drm/i915/intel_dp.c +3
-0+for (lane_count = max_lane_count; + lane_count >= min_lane_count; + lane_count >>= 1) {
link_clock= common_rates[clock];link_avail= intel_dp_max_data_rate(link_clock,
Signature · 6 lines
Mika Kahola - Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/14] drm/i915: Reverse the loop in intel_dp_compute_config
Quoted 21 lines · Mika Kahola
Quoted 20 lines · Manasi Navare
While configuring the pipe during modeset, it should loop starting from max clock and max lane count reducing the lane count and clock in each iteration until the requested mode rate is less than or equal to available link BW.
Signed-off-by Manasi Navare <[email protected]>---
drivers/gpu/drm/i915/intel_dp.c | 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -1552,11 +1552,10 @@ intel_dp_compute_config(struct intel_encoder *encoder, for (; bpp >= 6*3; bpp -= 2*3) {
mode_rate= intel_dp_link_required(adjusted_mode-Quoted 1 line
crtc_clock,
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder,
Quoted 8 lines
bpp);
drivers/gpu/drm/i915/intel_dp.c +0
-2- -for (clock = min_clock; clock <= max_clock; clock++){
drivers/gpu/drm/i915/intel_dp.c +1
-3-for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { +for (clock = max_clock; clock >= max_clock; clock--)The clock should be higher than or equal to
min_clock.
Thanks for the review. Yes that is a mistake. I will fix this in the loop.
Quoted 11 lines
Quoted 8 lines
{
drivers/gpu/drm/i915/intel_dp.c +3
-0+for (lane_count = max_lane_count; + lane_count >= min_lane_count; + lane_count >>= 1) {
link_clock= common_rates[clock];link_avail= intel_dp_max_data_rate(link_clock,Signature · 1 line
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/14] drm/i915: Reverse the loop in intel_dp_compute_config
In reply to Manasi NavareQuoted 20 lines · Manasi Navare
While configuring the pipe during modeset, it should loop starting from max clock and max lane count reducing the lane count and clock in each iteration until the requested mode rate is less than or equal to available link BW.
Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_dp.c +0
-2@@ -1552,11 +1552,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,for (; bpp >=6 *3 ; bpp -=2 *3 ) { mode_rate =intel_dp_link_required (adjusted_mode->crtc_clock, bpp); - -for (clock = min_clock; clock <= max_clock; clock++) {
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1561
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +4
-3-for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { +for (clock = max_clock; clock >= max_clock; clock--) { +for (lane_count = max_lane_count; + lane_count >= min_lane_count; + lane_count >>=1 ) { link_clock = common_rates[clock]; link_avail = intel_dp_max_data_rate(link_clock,
I don't understand why the loop is still here? We are starting with the max.link rate and max.lane count. If that is not good enough for the mode rate, then lowering link bandwidth won't help.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 12/14 drm/i915: Remove the link rate and lane count loop in compute config
In reply to Manasi NavareWhile configuring the pipe during modeset, it should use max clock and max lane count and reduce the bpp until the requested mode rate is less than or equal to available link BW.
This is required to pass DP Compliance.
v2:
* Removed the loop since we use max values of clock and lane count (Dhinakaran Pandiyan)
--- drivers/gpu/drm/i915/intel_dp.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +8 -14
@@ -1567,20 +1567,14 @@ intel_dp_compute_config(struct intel_encoder *encoder,for (; bpp >=6 *3 ; bpp -=2 *3 ) { mode_rate =intel_dp_link_required (adjusted_mode->crtc_clock, bpp); - -for (clock = min_clock; clock <= max_clock; clock++) { -for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { - - link_clock = common_rates[clock]; - link_avail =intel_dp_max_data_rate (link_clock, - lane_count); - -if (mode_rate <= link_avail) { - goto found; - } - } + clock = max_clock; + lane_count = max_lane_count; + link_clock = common_rates[clock]; + link_avail =intel_dp_max_data_rate (link_clock, + lane_count); + +if (mode_rate <= link_avail) { + goto found; } }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v15 13/14 drm/i915/dp: Enable Upfront link training for typeC DP support on HSW/BDW/SKL/BXT (DDI platforms)
From: Durgadoss R <[email protected]>
To support USB type C alternate DP mode, the display driver needs to know the number of lanes required by the DP panel as well as number of lanes that can be supported by the type-C cable. Sometimes, the type-C cable may limit the bandwidth even if Panel can support more lanes. To address these scenarios, the display driver will start link training with max lanes, and if that fails, the driver falls back to x2 lanes; and repeats this procedure for all bandwidth/lane configurations.
* Since link training is done before modeset only the port (and not pipe/planes) and its associated PLLs are enabled.
* On DP hotplug: Directly start link training on the DP encoder.
* On Connected boot scenarios: When booted with an LFP and a DP, sometimes BIOS brings up DP. In these cases, we disable the crtc and then do upfront link training; and bring it back up.
* All local changes made for upfront link training are reset to their previous values once it is done; so that the subsequent modeset is not aware of these changes.
Changes since v14:
* Rebased on new revision of compute config patch (Manasi) Changes since v13:
* Fix some indentation issues (Mika Kahola)
Changes since v12:
* Fix Rebase issues (Mika Kahola)
Changes since v11:
* Change the fallback link rate logic (Manasi)
Changes since v10:
* Use the ddi link train function that loops through all the link rates and lane counts starting from the highest supported (Manasi)
* For upfront link training, set the upfront flag so that the link can be disabled after caching upfront values (Manasi)
Changes since v9:
* Change the macros to use dev_priv in place of dev (David Weinehall) Changes since v8:
* Reset upfront lane count and link rate values on HPD
for DP connector physical disconnect (Manasi)
Changes since v7:
* Move the upfront link training to intel_dp_mode_valid()
to avoid a race condition with DP MST sideband comms. (Ville)
Changes since v6:
* Fix some initialization bugs on link_rate (Jim Bride)
* Use link_rate (and not link_bw) for upfront (Ville)
* Make intel_dp_upfront*() as a vfunc (Ander)
* The train_set_valid variable in intel_dp was removed due to issues in fast link training. So, to indicate the link train status, move the channel_eq inside intel_dp.
Changes since v5:
* Moved retry logic in upfront to intel_dp.c so that it
can be used for all platforms.
Changes since v4:
* Removed usage of crtc_state in upfront link training; Hence no need to find free crtc to do upfront now.
* Re-enable crtc if it was disabled for upfront.
* Use separate variables to track max lane count
and link rate found by upfront, without modifying
the original DPCD read from panel.
Changes since v3:
* Fixed a return value on BXT check
* Reworked on top of bxt_ddi_pll_select split from Ander
* Renamed from ddi_upfront to bxt_upfront since the
upfront logic includes BXT specific functions for now.
Changes since v2:
* Rebased on top of latest dpll_mgr.c code and
latest HPD related clean ups.
* Corrected return values from upfront (Ander)
* Corrected atomic locking for upfront in intel_dp.c (Ville) Changes since v1:
* all pll related functions inside ddi.c
--- drivers/gpu/drm/i915/intel_ddi.c | 21 +- drivers/gpu/drm/i915/intel_dp.c | 377 +++++++++++++++++++------- drivers/gpu/drm/i915/intel_dp_link_training.c | 1 - drivers/gpu/drm/i915/intel_drv.h | 14 +- 4 files changed, 312 insertions(+), 101 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +19 -2
@@ -1673,7 +1673,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, pll->config.crtc_mask =0 ;/* If Link Training fails, send a uevent to generate a hotplug */ -if (!(intel_ddi_link_train (intel_dp, link_rate, lane_count, link_mst))) +if (!(intel_ddi_link_train (intel_dp, link_rate, lane_count, link_mst, + false)))drm_kms_helper_hotplug_event (encoder->base.dev); pll->config = tmp_pll_config; }
@@ -2461,7 +2462,7 @@ intel_ddi_get_link_dpll(struct intel_dp *intel_dp, int clock)bool intel_ddi_link_train (struct intel_dp *intel_dp,int max_link_rate, -uint8_t max_lane_count,bool link_mst) +uint8_t max_lane_count,bool link_mst,bool is_upfront) {struct intel_connector *connector = intel_dp->attached_connector;struct intel_encoder *encoder = connector->encoder;
@@ -2507,6 +2508,7 @@ intel_ddi_link_train(struct intel_dp *intel_dp, int max_link_rate, pll->funcs.disable (dev_priv, pll); pll->config = tmp_pll_config; } +if (ret) {DRM_DEBUG_KMS ("Link Training successful at link rate: " "%d lane:%d\n" , link_rate, lane_count);
@@ -2515,6 +2517,21 @@ intel_ddi_link_train(struct intel_dp *intel_dp, int max_link_rate, }intel_dp_stop_link_train (intel_dp); +if (is_upfront) { +DRM_DEBUG_KMS ("Upfront link train %s: link_clock:%d lanes:%d\n" , + ret ?"Passed" :"Failed" , + link_rate, lane_count); +/* Disable port followed by PLL for next retry/clean up */ +intel_ddi_post_disable (encoder,NULL ,NULL ); + pll->funcs.disable (dev_priv, pll); + pll->config = tmp_pll_config; +if (ret) { +/* Save the upfront values */ + intel_dp->max_lanes_upfront = lane_count; + intel_dp->max_link_rate_upfront = link_rate; + } + } +if (!lane_count)DRM_ERROR ("Link Training Failed\n" );
drivers/gpu/drm/i915/intel_dp.c +280 -97
454 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp_link_training.c +0 -1
@@ -304,7 +304,6 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)intel_dp_set_idle_link_train (intel_dp);return intel_dp->channel_eq_status; - }void intel_dp_stop_link_train (struct intel_dp *intel_dp)
drivers/gpu/drm/i915/intel_drv.h +13 -1
@@ -882,6 +882,12 @@ struct intel_dp {enum hdmi_force_audio force_audio;bool limited_color_range;bool color_range_auto; + +/* Upfront link train parameters */ +int max_link_rate_upfront; +uint8_t max_lanes_upfront; +bool upfront_done; +uint8_t dpcd[DP_RECEIVER_CAP_SIZE ];uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE ];uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS ];
@@ -939,6 +945,11 @@ struct intel_dp {/* This is called before a link training is starterd */ void (*prepare_link_retrain)(struct intel_dp *intel_dp); +/* For Upfront link training */ +bool (*upfront_link_train)(struct intel_dp *intel_dp,int clock, +uint8_t lane_count,bool link_mst, +bool is_upfront); +/* Displayport compliance testing */ unsigned long compliance_test_type;unsigned long compliance_test_data;
@@ -1161,7 +1172,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp);bool intel_ddi_link_train (struct intel_dp *intel_dp,int max_link_rate, -uint8_t max_lane_count,bool link_mst); +uint8_t max_lane_count,bool link_mst, +bool is_upfront);struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock); unsigned int intel_fb_align_height(struct drm_device *dev,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH v15 13/14] drm/i915/dp: Enable Upfront link training for typeC DP support on HSW/BDW/SKL/BXT (DDI platforms)
Quoted 11 lines · Manasi Navare
From: Durgadoss R <[email protected]>
To support USB type C alternate DP mode, the display driver needs to know the number of lanes required by the DP panel as well as number of lanes that can be supported by the type-C cable. Sometimes, the type-C cable may limit the bandwidth even if Panel can support more lanes. To address these scenarios, the display driver will start link training with max lanes, and if that fails, the driver falls back to x2 lanes; and repeats this procedure for all bandwidth/lane configurations.
Quoted 9 lines
* Since link training is done before modeset only the port (and not pipe/planes) and its associated PLLs are enabled.
* On DP hotplug: Directly start link training on the DP encoder.
* On Connected boot scenarios: When booted with an LFP and a DP, sometimes BIOS brings up DP. In these cases, we disable the crtc and then do upfront link training; and bring it back up.
* All local changes made for upfront link training are reset to their previous values once it is done; so that the subsequent modeset is not aware of these changes.
As I said for a previous version, this needs to be split to functional and non-functional parts.
drivers/gpu/drm/i915/intel_dp.c intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · line 5800
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +4
-0@@ -5618,6 +5794,13 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (type == DRM_MODE_CONNECTOR_eDP) intel_encoder->type =INTEL_OUTPUT_EDP ; +/* Initialize upfront link training vfunc for DP */ +if (intel_encoder->type !=INTEL_OUTPUT_EDP ) { +if (IS_BROXTON (dev_priv) ||IS_SKYLAKE (dev_priv) || +IS_BROADWELL (dev_priv) ||IS_HASWELL (dev_priv))
What's this based on? What happened to Kabylake?
Quoted 57 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ intel_dp->upfront_link_train = intel_ddi_link_train; + } +/* eDP only on port B and/or C on vlv/chv */ if (WARN_ON ((IS_VALLEYVIEW (dev) ||IS_CHERRYVIEW (dev)) &&is_edp (intel_dp) && port !=PORT_B && port !=PORT_C ))drivers/gpu/drm/i915/intel_dp_link_training.c +0
-1@@ -304,7 +304,6 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)intel_dp_set_idle_link_train (intel_dp);return intel_dp->channel_eq_status; - }void intel_dp_stop_link_train (struct intel_dp *intel_dp)drivers/gpu/drm/i915/intel_drv.h +13
-1@@ -882,6 +882,12 @@ struct intel_dp {enum hdmi_force_audio force_audio;bool limited_color_range;bool color_range_auto; + +/* Upfront link train parameters */ +int max_link_rate_upfront; +uint8_t max_lanes_upfront; +bool upfront_done; +uint8_t dpcd[DP_RECEIVER_CAP_SIZE ];uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE ];uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS ];@@ -939,6 +945,11 @@ struct intel_dp {/* This is called before a link training is starterd */ void (*prepare_link_retrain)(struct intel_dp *intel_dp); +/* For Upfront link training */ +bool (*upfront_link_train)(struct intel_dp *intel_dp,int clock, +uint8_t lane_count,bool link_mst, +bool is_upfront); +/* Displayport compliance testing */ unsigned long compliance_test_type;unsigned long compliance_test_data;@@ -1161,7 +1172,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp);bool intel_ddi_link_train (struct intel_dp *intel_dp,int max_link_rate, -uint8_t max_lane_count,bool link_mst); +uint8_t max_lane_count,bool link_mst, +bool is_upfront);struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock); unsigned int intel_fb_align_height(struct drm_device *dev,
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 12/14] drm/i915: Remove the link rate and lane count loop in compute config
In reply to Manasi NavareQuoted 29 lines · Manasi Navare
While configuring the pipe during modeset, it should use max clock and max lane count and reduce the bpp until the requested mode rate is less than or equal to available link BW.
This is required to pass DP Compliance.v2:
* Removed the loop since we use max values of clock and lane count (Dhinakaran Pandiyan)Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_dp.c +0
-6@@ -1567,20 +1567,14 @@ intel_dp_compute_config(struct intel_encoder *encoder,for (; bpp >=6 *3 ; bpp -=2 *3 ) { mode_rate =intel_dp_link_required (adjusted_mode->crtc_clock, bpp); - -for (clock = min_clock; clock <= max_clock; clock++) { -for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { -
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1571
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2
-8- link_clock = common_rates[clock]; - link_avail =intel_dp_max_data_rate (link_clock, - lane_count); - -if (mode_rate <= link_avail) { - goto found; - } - } + clock = max_clock; + lane_count = max_lane_count;
Do we still need lane_count? We can eliminate it if it's always going to be max_lane_count.
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1572
Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1
-0+ link_clock = common_rates[clock];
Same here for link_clock.
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1577
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ link_avail =intel_dp_max_data_rate (link_clock, + lane_count); + +if (mode_rate <= link_avail) { + goto found;
Print KMS debug if we cannot satisfy the mode_rate at the max DP link rate?
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1580
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0} }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 12/14] drm/i915: Remove the link rate and lane count loop in compute config
Quoted 35 lines · Dhinakaran
Quoted 34 lines · Manasi Navare
While configuring the pipe during modeset, it should use max clock and max lane count and reduce the bpp until the requested mode rate is less than or equal to available link BW.
This is required to pass DP Compliance.v2:
* Removed the loop since we use max values of clock and lane count (Dhinakaran Pandiyan)Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_dp.c +0
-11@@ -1567,20 +1567,14 @@ intel_dp_compute_config(struct intel_encoder *encoder,for (; bpp >=6 *3 ; bpp -=2 *3 ) { mode_rate =intel_dp_link_required (adjusted_mode->crtc_clock, bpp); - -for (clock = min_clock; clock <= max_clock; clock++) { -for (lane_count = min_lane_count; - lane_count <= max_lane_count; - lane_count <<=1 ) { - - link_clock = common_rates[clock]; - link_avail =intel_dp_max_data_rate (link_clock, - lane_count); - -if (mode_rate <= link_avail) {
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1571
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3- goto found; - } - } + clock = max_clock; + lane_count = max_lane_count;Do we still need
lane_count? We can eliminate it if it's always going to bemax_lane_count.
This is just to follow the paradigm and use lane count and link rate here while setting up the pipe config.
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1572
Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1
-0+ link_clock = common_rates[clock];Same here for
link_clock.
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1577
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ link_avail =intel_dp_max_data_rate (link_clock, + lane_count); + +if (mode_rate <= link_avail) { + goto found;Print KMS debug if we cannot satisfy the
mode_rateat the max DP link rate?
Agree, but I am going to add it outside the bpp loop. You should see a new patch soon.
Manasi
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 1580
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0} }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 7/14 drm/i915/dp: Add a standalone function to obtain shared dpll for HSW/BDW/SKL/BXT
In reply to Manasi NavareFrom: Jim Bride <[email protected]>
Add the PLL selection code for HSW/BDW/BXT/SKL into a stand-alone function in order to allow for the implementation of a platform neutral upfront link training function.
v3:
* Add Hooks for all DDI platforms into this standalone function
v2:
* Change the macro to use dev_priv instead of dev (David Weinehall)
--- drivers/gpu/drm/i915/intel_ddi.c | 38 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 38 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++- 4 files changed, 80 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +38 -0
@@ -2393,6 +2393,44 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } +struct intel_shared_dpll * +intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_shared_dpll *pll =NULL ; +struct intel_shared_dpll_config tmp_pll_config; +enum intel_dpll_id dpll_id; + +if (IS_BROXTON (dev_priv)) { + dpll_id = (enum intel_dpll_id )dig_port->port; +/* +* Select the required PLL. This works for platforms where +* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) { + +DRM_ERROR ("Shared DPLL in use. active_mask:%x\n" , + pll->active_mask); + pll =NULL ; + } + tmp_pll_config = pll->config; +if (!bxt_ddi_dp_set_dpll_hw_state (clock, + &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; + } + }else if (IS_SKYLAKE (dev_priv)) { + pll =skl_find_link_pll (dev_priv, clock); + }else if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { + pll =hsw_ddi_dp_get_dpll (encoder, clock); + } +return pll; +} +void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv =to_i915 (dev);
drivers/gpu/drm/i915/intel_dpll_mgr.c +38 -0
@@ -24,6 +24,44 @@#include "intel_drv.h" struct intel_shared_dpll * +skl_find_link_pll (struct drm_i915_private *dev_priv,int clock) +{ +struct intel_shared_dpll *pll =NULL ; +struct intel_dpll_hw_state dpll_hw_state; +enum intel_dpll_id i; +bool found = false; + +if (!skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return pll; + +for (i =DPLL_ID_SKL_DPLL1 ; i <=DPLL_ID_SKL_DPLL3 ; i++) { + pll = &dev_priv->shared_dplls[i]; + +/* Only want to check enabled timings first */ +if (pll->config.crtc_mask ==0 ) +continue ; + +if (memcmp (&dpll_hw_state, &pll->config.hw_state, +sizeof (pll->config.hw_state)) ==0 ) { + found = true; +break ; + } + } + +/* Ok no matching timings, maybe there's a free one? */ +for (i =DPLL_ID_SKL_DPLL1 ; + ((found == false) && (i <=DPLL_ID_SKL_DPLL3 )); i++) { + pll = &dev_priv->shared_dplls[i]; +if (pll->config.crtc_mask ==0 ) { + pll->config.hw_state = dpll_hw_state; +break ; + } + } + +return pll; +} + +struct intel_shared_dpll *intel_get_shared_dpll_by_id (struct drm_i915_private *dev_priv,enum intel_dpll_id id) {
drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
@@ -168,6 +168,8 @@ bool bxt_ddi_dp_set_dpll_hw_state(int clock,/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv, +int clock);/* HSW dpll related functions */
drivers/gpu/drm/i915/intel_drv.h +2 -1
@@ -1159,7 +1159,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); - +struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp, +int clock); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height, uint32_t pixel_format,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 07/14] drm/i915/dp: Add a standalone function to obtain shared dpll for HSW/BDW/SKL/BXT
Quoted 45 lines · Manasi Navare
From: Jim Bride <[email protected]>
Add the PLL selection code for HSW/BDW/BXT/SKL into a stand-alone function in order to allow for the implementation of a platform neutral upfront link training function.
v3:
* Add Hooks for all DDI platforms into this standalone functionv2:
* Change the macro to usedev_privinstead of dev (David Weinehall)Reviewed-by Durgadoss R <[email protected]>Signed-off-by Manasi Navare <[email protected]>Signed-off-by Jim Bride <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 38 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 38 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++- 4 files changed, 80 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_ddi.c +15
-0@@ -2393,6 +2393,44 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } +struct intel_shared_dpll * +intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_shared_dpll *pll =NULL ; +struct intel_shared_dpll_config tmp_pll_config; +enum intel_dpll_id dpll_id; + +if (IS_BROXTON (dev_priv)) { + dpll_id = (enum intel_dpll_id )dig_port->port; +/* +* Select the required PLL. This works for platforms where
drivers/gpu/drm/i915/intel_ddi.c intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port) · line 2420
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) { + +DRM_ERROR ("Shared DPLL in use. active_mask:%x\n" , + pll->active_mask); + pll =NULL ; + } + tmp_pll_config = pll->config;
NULL dereference when pll is in use?
Quoted 83 lines
drivers/gpu/drm/i915/intel_ddi.c +13
-0+if (!bxt_ddi_dp_set_dpll_hw_state (clock, + &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; + } + }else if (IS_SKYLAKE (dev_priv)) { + pll =skl_find_link_pll (dev_priv, clock); + }else if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { + pll =hsw_ddi_dp_get_dpll (encoder, clock); + } +return pll; +} +void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv =to_i915 (dev);drivers/gpu/drm/i915/intel_dpll_mgr.c +38
-0@@ -24,6 +24,44 @@#include "intel_drv.h" struct intel_shared_dpll * +skl_find_link_pll (struct drm_i915_private *dev_priv,int clock) +{ +struct intel_shared_dpll *pll =NULL ; +struct intel_dpll_hw_state dpll_hw_state; +enum intel_dpll_id i; +bool found = false; + +if (!skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return pll; + +for (i =DPLL_ID_SKL_DPLL1 ; i <=DPLL_ID_SKL_DPLL3 ; i++) { + pll = &dev_priv->shared_dplls[i]; + +/* Only want to check enabled timings first */ +if (pll->config.crtc_mask ==0 ) +continue ; + +if (memcmp (&dpll_hw_state, &pll->config.hw_state, +sizeof (pll->config.hw_state)) ==0 ) { + found = true; +break ; + } + } + +/* Ok no matching timings, maybe there's a free one? */ +for (i =DPLL_ID_SKL_DPLL1 ; + ((found == false) && (i <=DPLL_ID_SKL_DPLL3 )); i++) { + pll = &dev_priv->shared_dplls[i]; +if (pll->config.crtc_mask ==0 ) { + pll->config.hw_state = dpll_hw_state; +break ; + } + } + +return pll; +} + +struct intel_shared_dpll *intel_get_shared_dpll_by_id (struct drm_i915_private *dev_priv,enum intel_dpll_id id) {drivers/gpu/drm/i915/intel_dpll_mgr.h +2
-0@@ -168,6 +168,8 @@ bool bxt_ddi_dp_set_dpll_hw_state(int clock,/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv, +int clock);/* HSW dpll related functions */ drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h void intel_ddi_clock_get(struct intel_encoder *encoder, · line 1166
Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -1159,7 +1159,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); - +struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp, +int clock); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height, uint32_t pixel_format,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 07/14] drm/i915/dp: Add a standalone function to obtain shared dpll for HSW/BDW/SKL/BXT
Quoted 50 lines · Dhinakaran
Quoted 49 lines · Manasi Navare
From: Jim Bride <[email protected]>
Add the PLL selection code for HSW/BDW/BXT/SKL into a stand-alone function in order to allow for the implementation of a platform neutral upfront link training function.
v3:
* Add Hooks for all DDI platforms into this standalone functionv2:
* Change the macro to usedev_privinstead of dev (David Weinehall)Reviewed-by Durgadoss R <[email protected]>Signed-off-by Manasi Navare <[email protected]>Signed-off-by Jim Bride <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 38 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 38 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++- 4 files changed, 80 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_ddi.c +19
-0@@ -2393,6 +2393,44 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } +struct intel_shared_dpll * +intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_shared_dpll *pll =NULL ; +struct intel_shared_dpll_config tmp_pll_config; +enum intel_dpll_id dpll_id; + +if (IS_BROXTON (dev_priv)) { + dpll_id = (enum intel_dpll_id )dig_port->port; +/* +* Select the required PLL. This works for platforms where +* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) {
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port) · line 2420
Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6
-0+ +DRM_ERROR ("Shared DPLL in use. active_mask:%x\n" , + pll->active_mask); + pll =NULL ; + } + tmp_pll_config = pll->config;NULL dereference when pll is in use?
Yes I had given this comment in the internal review. So we moved this assignment out to the calling function, but left this here as well. I will remove this and resubmit.
Manasi
Quoted 78 lines
Quoted 78 lines
drivers/gpu/drm/i915/intel_ddi.c +13
-0+if (!bxt_ddi_dp_set_dpll_hw_state (clock, + &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; + } + }else if (IS_SKYLAKE (dev_priv)) { + pll =skl_find_link_pll (dev_priv, clock); + }else if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { + pll =hsw_ddi_dp_get_dpll (encoder, clock); + } +return pll; +} +void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv =to_i915 (dev);drivers/gpu/drm/i915/intel_dpll_mgr.c +38
-0@@ -24,6 +24,44 @@#include "intel_drv.h" struct intel_shared_dpll * +skl_find_link_pll (struct drm_i915_private *dev_priv,int clock) +{ +struct intel_shared_dpll *pll =NULL ; +struct intel_dpll_hw_state dpll_hw_state; +enum intel_dpll_id i; +bool found = false; + +if (!skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return pll; + +for (i =DPLL_ID_SKL_DPLL1 ; i <=DPLL_ID_SKL_DPLL3 ; i++) { + pll = &dev_priv->shared_dplls[i]; + +/* Only want to check enabled timings first */ +if (pll->config.crtc_mask ==0 ) +continue ; + +if (memcmp (&dpll_hw_state, &pll->config.hw_state, +sizeof (pll->config.hw_state)) ==0 ) { + found = true; +break ; + } + } + +/* Ok no matching timings, maybe there's a free one? */ +for (i =DPLL_ID_SKL_DPLL1 ; + ((found == false) && (i <=DPLL_ID_SKL_DPLL3 )); i++) { + pll = &dev_priv->shared_dplls[i]; +if (pll->config.crtc_mask ==0 ) { + pll->config.hw_state = dpll_hw_state; +break ; + } + } + +return pll; +} + +struct intel_shared_dpll *intel_get_shared_dpll_by_id (struct drm_i915_private *dev_priv,enum intel_dpll_id id) {drivers/gpu/drm/i915/intel_dpll_mgr.h +2
-0@@ -168,6 +168,8 @@ bool bxt_ddi_dp_set_dpll_hw_state(int clock,/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv, +int clock);
Quoted 16 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_dpll_mgr.h +0
-0/* HSW dpll related functions */ drivers/gpu/drm/i915/intel_drv.h +0
-0drivers/gpu/drm/i915/intel_drv.h void intel_ddi_clock_get(struct intel_encoder *encoder, · line 1166
Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -1159,7 +1159,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); - +struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp, +int clock); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height, uint32_t pixel_format,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 7/14 drm/i915/dp: Add a standalone function to obtain shared dpll for HSW/BDW/SKL/BXT
In reply to Manasi NavareFrom: Jim Bride <[email protected]>
Add the PLL selection code for HSW/BDW/BXT/SKL into a stand-alone function in order to allow for the implementation of a platform neutral upfront link training function.
v4:
* Removed dereferencing NULL pointer in case of failure (Dhinakaran Pandiyan) v3:
* Add Hooks for all DDI platforms into this standalone function
v2:
* Change the macro to use dev_priv instead of dev (David Weinehall)
--- drivers/gpu/drm/i915/intel_ddi.c | 39 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 38 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++- 4 files changed, 81 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +39 -0
@@ -2393,6 +2393,45 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } +struct intel_shared_dpll * +intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_shared_dpll *pll =NULL ; +struct intel_shared_dpll_config tmp_pll_config; +enum intel_dpll_id dpll_id; + +if (IS_BROXTON (dev_priv)) { + dpll_id = (enum intel_dpll_id )dig_port->port; +/* +* Select the required PLL. This works for platforms where +* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) { + +DRM_ERROR ("Shared DPLL in use. active_mask:%x\n" , + pll->active_mask); +return NULL ; + } + tmp_pll_config = pll->config; +if (!bxt_ddi_dp_set_dpll_hw_state (clock, + &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; +return NULL ; + } + }else if (IS_SKYLAKE (dev_priv)) { + pll =skl_find_link_pll (dev_priv, clock); + }else if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { + pll =hsw_ddi_dp_get_dpll (encoder, clock); + } +return pll; +} +void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv =to_i915 (dev);
drivers/gpu/drm/i915/intel_dpll_mgr.c +38 -0
@@ -24,6 +24,44 @@#include "intel_drv.h" struct intel_shared_dpll * +skl_find_link_pll (struct drm_i915_private *dev_priv,int clock) +{ +struct intel_shared_dpll *pll =NULL ; +struct intel_dpll_hw_state dpll_hw_state; +enum intel_dpll_id i; +bool found = false; + +if (!skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return pll; + +for (i =DPLL_ID_SKL_DPLL1 ; i <=DPLL_ID_SKL_DPLL3 ; i++) { + pll = &dev_priv->shared_dplls[i]; + +/* Only want to check enabled timings first */ +if (pll->config.crtc_mask ==0 ) +continue ; + +if (memcmp (&dpll_hw_state, &pll->config.hw_state, +sizeof (pll->config.hw_state)) ==0 ) { + found = true; +break ; + } + } + +/* Ok no matching timings, maybe there's a free one? */ +for (i =DPLL_ID_SKL_DPLL1 ; + ((found == false) && (i <=DPLL_ID_SKL_DPLL3 )); i++) { + pll = &dev_priv->shared_dplls[i]; +if (pll->config.crtc_mask ==0 ) { + pll->config.hw_state = dpll_hw_state; +break ; + } + } + +return pll; +} + +struct intel_shared_dpll *intel_get_shared_dpll_by_id (struct drm_i915_private *dev_priv,enum intel_dpll_id id) {
drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
@@ -168,6 +168,8 @@ bool bxt_ddi_dp_set_dpll_hw_state(int clock,/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv, +int clock);/* HSW dpll related functions */
drivers/gpu/drm/i915/intel_drv.h +2 -1
@@ -1159,7 +1159,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); - +struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp, +int clock); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height, uint32_t pixel_format,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/14 drm/i915/dp/mst: Add support for upfront link training for DP MST
In reply to Manasi NavareFrom: Jim Bride <[email protected]>
Add upfront link training to intel_dp_mst_mode_valid() so that we know topology constraints before we validate the legality of modes to be checked.
Call the function that loops through the link rates and lane counts starting from highest supported link rate and lane count for training the link in compliance with DP spec
--- drivers/gpu/drm/i915/intel_dp.c | 9 ++--- drivers/gpu/drm/i915/intel_dp_mst.c | 74 +++++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 3 ++ 3 files changed, 61 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -5
@@ -131,7 +131,7 @@ static void vlv_steal_power_sequencer(struct drm_device *dev, enum pipe pipe);static void intel_dp_unset_edid (struct intel_dp *intel_dp); -static int +int intel_dp_max_link_bw (struct intel_dp *intel_dp) {int max_link_bw = intel_dp->dpcd[DP_MAX_LINK_RATE ];
@@ -150,7 +150,7 @@ intel_dp_max_link_bw(struct intel_dp *intel_dp)return max_link_bw; } -static u8 intel_dp_max_lane_count (struct intel_dp *intel_dp) +u8 intel_dp_max_lane_count (struct intel_dp *intel_dp) {struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);u8 temp, source_max, sink_max;
@@ -312,8 +312,7 @@ static int intersect_rates(const int *source_rates, int source_len,return k; } -static int intel_dp_common_rates (struct intel_dp *intel_dp, -int *common_rates) +int intel_dp_common_rates (struct intel_dp *intel_dp,int *common_rates) {const int *source_rates, *sink_rates;int source_len, sink_len;
@@ -336,7 +335,7 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp, common_rates); } -static bool intel_dp_upfront_link_train (struct intel_dp *intel_dp) +bool intel_dp_upfront_link_train (struct intel_dp *intel_dp) {struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);struct intel_encoder *intel_encoder = &intel_dig_port->base;
drivers/gpu/drm/i915/intel_dp_mst.c +54 -20
108 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -1416,6 +1416,7 @@ void intel_edp_panel_off(struct intel_dp *intel_dp);void intel_dp_add_properties (struct intel_dp *intel_dp,struct drm_connector *connector);void intel_dp_mst_suspend (struct drm_device *dev);void intel_dp_mst_resume (struct drm_device *dev); +u8 intel_dp_max_lane_count (struct intel_dp *intel_dp);int intel_dp_max_link_rate (struct intel_dp *intel_dp);int intel_dp_rate_select (struct intel_dp *intel_dp,int rate);void intel_dp_hot_plug (struct intel_encoder *intel_encoder);
@@ -1446,6 +1447,8 @@ intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing);void intel_dp_compute_rate (struct intel_dp *intel_dp,int port_clock,uint8_t *link_bw,uint8_t *rate_select);bool intel_dp_source_supports_hbr2 (struct intel_dp *intel_dp); +int intel_dp_common_rates (struct intel_dp *intel_dp,int *common_rates); +bool intel_dp_upfront_link_train (struct intel_dp *intel_dp);bool intel_dp_get_link_status (struct intel_dp *intel_dp,uint8_t link_status[DP_LINK_STATUS_SIZE ]);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for Enable upfront link training on DDI platforms (rev3)
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: Enable upfront link training on DDI platforms (rev3)
URL : https://patchwork.freedesktop.org/series/10821/
State : failure
== Summary ==
Series 10821v3 Enable upfront link training on DDI platforms
http://patchwork.freedesktop.org/api/1.0/series/10821/revisions/3/mbox/
Test gem_mmap_gtt:
Subgroup basic-wc:
fail -> PASS (fi-byt-n2820)
Test kms_cursor_legacy:
Subgroup basic-cursor-vs-flip-legacy:
fail -> PASS (fi-byt-n2820)
Subgroup basic-cursor-vs-flip-varying-size:
fail -> PASS (fi-byt-n2820)
Test kms_flip:
Subgroup basic-flip-vs-dpms:
pass -> DMESG-FAIL (fi-byt-n2820)
Subgroup basic-flip-vs-modeset:
pass -> DMESG-WARN (fi-byt-n2820)
Subgroup basic-flip-vs-wf_vblank:
pass -> DMESG-WARN (fi-byt-n2820)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
skip -> PASS (fi-hsw-4770r)
Subgroup suspend-read-crc-pipe-b:
skip -> PASS (fi-byt-n2820)
Test prime_busy:
Subgroup basic-after-default:
fail -> PASS (fi-byt-n2820)
Subgroup basic-before-default:
fail -> PASS (fi-byt-n2820)
Subgroup basic-wait-after-default:
fail -> PASS (fi-byt-n2820)
Subgroup basic-wait-before-default:
fail -> PASS (fi-byt-n2820)
Test prime_vgem:
Subgroup basic-busy-default:
fail -> PASS (fi-byt-n2820)
Subgroup basic-sync-default:
fail -> PASS (fi-byt-n2820)
Subgroup basic-wait-default:
fail -> PASS (fi-byt-n2820)fi-bdw-5557u total:252 pass:233 dwarn:2 dfail:1 fail:1 skip:15 fi-bsw-n3050 total:252 pass:203 dwarn:1 dfail:1 fail:1 skip:46 fi-byt-n2820 total:252 pass:206 dwarn:2 dfail:1 fail:2 skip:41 fi-hsw-4770k total:252 pass:226 dwarn:2 dfail:1 fail:1 skip:22 fi-hsw-4770r total:252 pass:222 dwarn:2 dfail:1 fail:1 skip:26 fi-ivb-3520m total:252 pass:217 dwarn:2 dfail:1 fail:1 skip:31 fi-skl-6260u total:252 pass:234 dwarn:2 dfail:1 fail:1 skip:14 fi-skl-6700k total:252 pass:219 dwarn:3 dfail:1 fail:1 skip:28 fi-snb-2520m total:252 pass:204 dwarn:2 dfail:1 fail:2 skip:43 fi-snb-2600 total:252 pass:204 dwarn:2 dfail:1 fail:2 skip:43
Results at /archive/results/CI_IGT_test/Patchwork_2462/
e86e853d531af69111a41258650ec73650a59810 drm-intel-nightly: 2016y-09m-01d-18h-16m-46s UTC integration manifest 72c79f1 drm/i915/dp/mst: Add support for upfront link training for DP MST
645e2b7 drm/i915/dp: Enable Upfront link training for typeC DP support on HSW/BDW/SKL/BXT (DDI platforms) 0d2222b drm/i915: Reverse the loop in intel_dp_compute_configd8d1c9a9 drm/i915: Fallback to lower link rate and lane count during link training
1b9f8e1 drm/i915: Make DP link training channel equalization DP 1.2 Spec compliant
1cc2484 drm/dp/i915: Make clock recovery in the link training compliant with DP Spec 1.2 325eea2 drm/i915/dp: Move max. vswing check to it's own function
b3c34be drm/i915/dp: Add a standalone function to obtain shared dpll for HSW/BDW/SKL/BXT ebb5d40 drm/i915: Split hsw_get_dpll()
c441042 drm/i915: Split skl_get_dpll()
d40a544 drm/i915: Split bxt_ddi_pll_select()
c515f49 drm/i915: Split intel_ddi_pre_enable() into DP and HDMI versions
c37be1c drm/i915: Remove ddi_pll_sel from intel_crtc_state
926be20 drm/i915: Don't pass crtc_state to intel_dp_set_link_params()
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for Enable upfront link training on DDI platforms (rev8)
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: Enable upfront link training on DDI platforms (rev8)
URL : https://patchwork.freedesktop.org/series/10821/
State : warning
== Summary ==
Series 10821v8 Enable upfront link training on DDI platforms
http://patchwork.freedesktop.org/api/1.0/series/10821/revisions/8/mbox/
Test kms_pipe_crc_basic:
Subgroup bad-source:
pass -> DMESG-WARN (fi-hsw-4770k)
Subgroup read-crc-pipe-b:
pass -> SKIP (fi-hsw-4770r)
Subgroup suspend-read-crc-pipe-a:
pass -> SKIP (fi-hsw-4770k)fi-bdw-5557u total:252 pass:233 dwarn:2 dfail:1 fail:1 skip:15 fi-bsw-n3050 total:252 pass:203 dwarn:1 dfail:1 fail:1 skip:46 fi-byt-n2820 total:252 pass:206 dwarn:2 dfail:1 fail:2 skip:41 fi-hsw-4770k total:252 pass:224 dwarn:3 dfail:1 fail:1 skip:23 fi-hsw-4770r total:252 pass:221 dwarn:2 dfail:1 fail:1 skip:27 fi-ivb-3520m total:252 pass:217 dwarn:2 dfail:1 fail:1 skip:31 fi-skl-6260u total:252 pass:234 dwarn:2 dfail:1 fail:1 skip:14 fi-skl-6700k total:252 pass:219 dwarn:3 dfail:1 fail:1 skip:28 fi-snb-2520m total:252 pass:204 dwarn:2 dfail:1 fail:2 skip:43 fi-snb-2600 total:252 pass:205 dwarn:2 dfail:1 fail:1 skip:43
Results at /archive/results/CI_IGT_test/Patchwork_2477/
980cf7a5d9c420afbaf52a339a2005339f9f8319 drm-intel-nightly: 2016y-09m-06d-18h-01m-33s UTC integration manifest b8c7c7b drm/i915/dp: Add a standalone function to obtain shared dpll for HSW/BDW/SKL/BXT 5e7a9cf drm/i915: Split hsw_get_dpll()
00eba02 drm/i915: Split skl_get_dpll()
0643769 drm/i915: Split bxt_ddi_pll_select()
b58acd4 drm/i915: Split intel_ddi_pre_enable() into DP and HDMI versions
15463d9 drm/i915: Remove ddi_pll_sel from intel_crtc_state
dc02fad drm/i915: Don't pass crtc_state to intel_dp_set_link_params()
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx