intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lee Shawn C <shawn.c.lee@intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp/mst : Get clock rate from sink's available PBN
Date: Wed, 8 Jan 2020 17:15:51 +0200	[thread overview]
Message-ID: <20200108151551.GL1208@intel.com> (raw)
In-Reply-To: <20200106174156.11081-1-shawn.c.lee@intel.com>

On Tue, Jan 07, 2020 at 01:41:56AM +0800, Lee Shawn C wrote:
> Driver report physcial bandwidth for max dot clock rate.
> It would caused compatibility issue sometimes when physical
> bandwidth exceed MST hub output ability.
> 
> For example, here is a MST hub with HDMI 1.4 and DP 1.2 output.
> And source have DP 1.2 output capability. Connect a HDMI 2.0
> display then source will retrieve EDID from external monitor.
> Driver got max resolution was 4k@60fps. DP 1.2 can support
> this resolution because it did not surpass max physical bandwidth.
> After modeset, source output display data but MST hub can't
> output HDMI properly due to it already over HDMI 1.4 spec.
> 
> Apply this calculation, source calcualte max dot clock according
> to available PBN. Driver will remove the mode that over current
> clock rate. And external display can works normally.
> 
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Cooper Chiou <cooper.chiou@intel.com>
> 
> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 27 ++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 3b066c63816d..eaa440165ad2 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -550,6 +550,27 @@ static int intel_dp_mst_get_modes(struct drm_connector *connector)
>  	return intel_dp_mst_get_ddc_modes(connector);
>  }
>  
> +static int
> +intel_dp_mst_downstream_max_dotclock(struct drm_connector *connector)
> +{
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +	struct intel_dp *intel_dp = intel_connector->mst_port;
> +	struct drm_dp_mst_port *port;
> +	u64 clock_rate = 0;
> +
> +	if (intel_dp->mst_mgr.mst_primary)
> +		list_for_each_entry(port, &intel_dp->mst_mgr.mst_primary->ports, next)
> +			if (port->connector == connector) {
> +				clock_rate = ((u64)port->available_pbn * (54 * 8 * 1000 * 1000)) / (64 * 1006);

IIRC avaible pbn is soime kind of dynamic "how much bw we have left
currently" so we don't want to use it for this purpose. If we really
wanted to do this we'd have to refilter the modelist and generate
hotplugs whenever the bw allocations change.

In the current design what should happens is that we check that we
have enough bw when doing the modeset, and if that fails userspace
is supposed to handle the situation in some graceful manner.

Also locking totally missing.

So nak.

> +
> +				// FIXME: We should used pipe bpp to do this calculation.
> +				//        But can't retrieve bpp setting from drm_connector.
> +				return (int)(clock_rate / 24);
> +			}
> +
> +	return to_i915(connector->dev)->max_dotclk_freq;
> +}
> +
>  static enum drm_mode_status
>  intel_dp_mst_mode_valid(struct drm_connector *connector,
>  			struct drm_display_mode *mode)
> @@ -557,8 +578,7 @@ intel_dp_mst_mode_valid(struct drm_connector *connector,
>  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
>  	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 max_rate, mode_rate, max_lanes, max_link_clock;
> +	int max_rate, mode_rate, max_lanes, max_link_clock, max_dotclk;
>  
>  	if (drm_connector_is_unregistered(connector))
>  		return MODE_ERROR;
> @@ -572,7 +592,8 @@ intel_dp_mst_mode_valid(struct drm_connector *connector,
>  	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
>  	mode_rate = intel_dp_link_required(mode->clock, 18);
>  
> -	/* TODO - validate mode against available PBN for link */
> +	max_dotclk = intel_dp_mst_downstream_max_dotclock(connector);
> +
>  	if (mode->clock < 10000)
>  		return MODE_CLOCK_LOW;
>  
> -- 
> 2.17.1

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

  parent reply	other threads:[~2020-01-08 15:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 17:41 [Intel-gfx] [PATCH] drm/i915/dp/mst : Get clock rate from sink's available PBN Lee Shawn C
2020-01-06  9:54 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2020-01-06 10:22 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-01-06 10:22 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-06 11:54 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-01-06 14:48 ` [Intel-gfx] [PATCH] " kbuild test robot
2020-01-08 15:15 ` Ville Syrjälä [this message]
2020-01-09  3:11   ` Lee, Shawn C
2020-02-05  5:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp/mst : Get clock rate from sink's available PBN (rev2) Patchwork
2020-02-05  6:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-02-05  6:45 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-02-05 13:18 ` [Intel-gfx] [PATCH v2] drm/i915/dp/mst : Get clock rate from sink's available PBN Lee Shawn C
2020-02-07 11:10 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/dp/mst : Get clock rate from sink's available PBN (rev2) Patchwork
2020-03-11 23:09 ` [Intel-gfx] [PATCH] drm/i915/dp/mst : Get clock rate from sink's available PBN Lyude Paul
2020-03-16 13:56   ` Lee, Shawn C
2020-03-19 17:26     ` Lyude Paul

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=20200108151551.GL1208@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=cooper.chiou@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shawn.c.lee@intel.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).