aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManasi Navare <manasi.d.navare@intel.com>2018-10-09 17:28:04 -0400
committerRodrigo Vivi <rodrigo.vivi@intel.com>2018-10-17 21:23:59 -0400
commit041444458835d7fb2c9f042598bfe16bf375b15d (patch)
tree76b1c2aebaba0156bef251d84ebcf67df1067ca1
parent4bbf0d4749e707b6b262d576a9a9ef5c63b52dd4 (diff)
drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode
This patch fixes the original commit c0cfb10d9e1de49 ("drm/i915/edp: Do not do link training fallback or prune modes on EDP") that causes a blank screen in case of certain eDP panels (Eg: seen on Dell XPS13 9350) where first link training fails and a retraining is required by falling back to lower link rate/lane count. In case of some panels they advertise higher link rate/lane count than whats required for supporting the panel's native mode. But we always link train at highest link rate/lane count for eDP and if that fails we can still fallback to lower link rate/lane count as long as the fallback link BW still fits the native mode to avoid pruning the panel's native mode yet retraining at fallback values to recover from a blank screen. v3: * Add const for fixed_mode (Ville) v2: * Send uevent if link failure on eDP unconditionally Fixes: c0cfb10d9e1d ("drm/i915/edp: Do not do link training fallback or prune modes on EDP") Cc: Clinton Taylor <clinton.a.taylor@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: <stable@vger.kernel.org> # v4.17+ Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107489 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105338 Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> Tested-by: Alexander Wilson <alexander.wilson@ncf.edu> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181009212804.702-1-manasi.d.navare@intel.com (cherry picked from commit 1e712535c51ab025ebc776d4405683d81521996d) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c30
-rw-r--r--drivers/gpu/drm/i915/intel_dp_link_training.c26
2 files changed, 39 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 6b4c19123f2a..06e91d7b6d8e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -557,6 +557,22 @@ static bool intel_dp_link_params_valid(struct intel_dp *intel_dp, int link_rate,
557 return true; 557 return true;
558} 558}
559 559
560static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp,
561 int link_rate,
562 uint8_t lane_count)
563{
564 const struct drm_display_mode *fixed_mode =
565 intel_dp->attached_connector->panel.fixed_mode;
566 int mode_rate, max_rate;
567
568 mode_rate = intel_dp_link_required(fixed_mode->clock, 18);
569 max_rate = intel_dp_max_data_rate(link_rate, lane_count);
570 if (mode_rate > max_rate)
571 return false;
572
573 return true;
574}
575
560int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, 576int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
561 int link_rate, uint8_t lane_count) 577 int link_rate, uint8_t lane_count)
562{ 578{
@@ -566,9 +582,23 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
566 intel_dp->num_common_rates, 582 intel_dp->num_common_rates,
567 link_rate); 583 link_rate);
568 if (index > 0) { 584 if (index > 0) {
585 if (intel_dp_is_edp(intel_dp) &&
586 !intel_dp_can_link_train_fallback_for_edp(intel_dp,
587 intel_dp->common_rates[index - 1],
588 lane_count)) {
589 DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n");
590 return 0;
591 }
569 intel_dp->max_link_rate = intel_dp->common_rates[index - 1]; 592 intel_dp->max_link_rate = intel_dp->common_rates[index - 1];
570 intel_dp->max_link_lane_count = lane_count; 593 intel_dp->max_link_lane_count = lane_count;
571 } else if (lane_count > 1) { 594 } else if (lane_count > 1) {
595 if (intel_dp_is_edp(intel_dp) &&
596 !intel_dp_can_link_train_fallback_for_edp(intel_dp,
597 intel_dp_max_common_rate(intel_dp),
598 lane_count >> 1)) {
599 DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n");
600 return 0;
601 }
572 intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp); 602 intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp);
573 intel_dp->max_link_lane_count = lane_count >> 1; 603 intel_dp->max_link_lane_count = lane_count >> 1;
574 } else { 604 } else {
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
index a9f40985a621..30be0e39bd5f 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -367,22 +367,14 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
367 return; 367 return;
368 368
369 failure_handling: 369 failure_handling:
370 /* Dont fallback and prune modes if its eDP */ 370 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d",
371 if (!intel_dp_is_edp(intel_dp)) { 371 intel_connector->base.base.id,
372 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", 372 intel_connector->base.name,
373 intel_connector->base.base.id, 373 intel_dp->link_rate, intel_dp->lane_count);
374 intel_connector->base.name, 374 if (!intel_dp_get_link_train_fallback_values(intel_dp,
375 intel_dp->link_rate, intel_dp->lane_count); 375 intel_dp->link_rate,
376 if (!intel_dp_get_link_train_fallback_values(intel_dp, 376 intel_dp->lane_count))
377 intel_dp->link_rate, 377 /* Schedule a Hotplug Uevent to userspace to start modeset */
378 intel_dp->lane_count)) 378 schedule_work(&intel_connector->modeset_retry_work);
379 /* Schedule a Hotplug Uevent to userspace to start modeset */
380 schedule_work(&intel_connector->modeset_retry_work);
381 } else {
382 DRM_ERROR("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d",
383 intel_connector->base.base.id,
384 intel_connector->base.name,
385 intel_dp->link_rate, intel_dp->lane_count);
386 }
387 return; 379 return;
388} 380}