[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180312211226.GT5453@intel.com>
Date: Mon, 12 Mar 2018 23:12:26 +0200
From: Ville Syrjälä <ville.syrjala@...ux.intel.com>
To: Lyude Paul <lyude@...hat.com>
Cc: intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
Manasi Navare <manasi.d.navare@...el.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
David Airlie <airlied@...ux.ie>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 5/5] drm/i915: Implement proper fallback training for
MST
On Fri, Mar 09, 2018 at 04:32:31PM -0500, Lyude Paul wrote:
> @@ -6266,25 +6368,98 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
> return false;
> }
>
> +static void intel_dp_mst_retrain_link_work(struct work_struct *work)
> +{
Why do we need another work for this? Can't we just retrain from the
hotplug work always?
> + struct drm_modeset_acquire_ctx ctx;
> + struct intel_dp *intel_dp = container_of(work, typeof(*intel_dp),
> + mst_retrain_work);
> + struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
> + struct drm_device *dev = intel_encoder->base.dev;
> + int ret;
> + bool had_error = false;
> +
> + drm_modeset_acquire_init(&ctx, 0);
> +
> + for (;;) {
> + ret = intel_dp_retrain_link(intel_encoder, &ctx);
> + if (ret == -EDEADLK) {
> + drm_modeset_backoff(&ctx);
> + continue;
> + }
> +
> + break;
> + }
> + if (!ret) {
> + DRM_DEBUG_KMS("Retrain complete\n");
> + goto out;
> + } else if (ret == -EIO) {
> + DRM_ERROR("IO error with sink during retrain? Aborting\n");
> + had_error = true;
> + goto out;
> + }
> +
> + DRM_DEBUG_KMS("Retraining failed with %d, marking link status as bad\n",
> + ret);
> +
> + /* We ran out of retries, if the sink hasn't changed the link rate in
> + * it's dpcd yet force us to fallback to a lower link rate/count */
> + if (ret == -EINVAL) {
> + ret = intel_dp_get_dpcd(intel_dp);
> + if (!ret) {
> + DRM_ERROR("IO error while reading dpcd from sink\n");
> + had_error = true;
> + goto out;
> + }
> +
> + if (intel_dp->link_rate == intel_dp_max_link_rate(intel_dp) &&
> + intel_dp->lane_count == intel_dp_max_lane_count(intel_dp)) {
> + intel_dp_get_link_train_fallback_values(
> + intel_dp, intel_dp_max_link_rate(intel_dp),
> + intel_dp_max_lane_count(intel_dp));
> + }
> + }
> +
> + intel_dp->mst_link_is_bad = true;
> + intel_dp->mst_bw_locked = false;
> + schedule_work(&intel_dp->modeset_retry_work);
> +out:
> + drm_modeset_drop_locks(&ctx);
> + drm_modeset_acquire_fini(&ctx);
> + if (had_error)
> + drm_kms_helper_hotplug_event(dev);
> +}
> +
--
Ville Syrjälä
Intel OTC
Powered by blists - more mailing lists