Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 4/5] drm/i915: Remove AUX CH sanitation
Date: Wed, 21 Jun 2023 11:00:31 +0300	[thread overview]
Message-ID: <874jn1fdnk.fsf@intel.com> (raw)
In-Reply-To: <20230620173242.26923-5-ville.syrjala@linux.intel.com>

On Tue, 20 Jun 2023, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Stop with the VBT AUX CH sanitation, and instead just check
> that the appropriate AUX CH is still available when initializing
> a DP/TC port.
>
> Note that the old way of sanitizing gave priority to the last
> port declared in the VBT, but now we sort of do the opposite by
> favoring the first encoder to succesfully initialize. The reason
> for the old "last port wins" preference was eg. Asrock B250M-HDV
> where port A (eDP) and port E (DP->VGA) have an AUX CH conflict
> and we need to prefer port E. However with the new way port A (eDP)
> will be probed first, but will fail to probe due to HPD and thus
> port E will still win in the end.

That's the kind of explanation I was after in the previous patch for ddc
pin.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/g4x_dp.c       |  3 ++
>  drivers/gpu/drm/i915/display/intel_bios.c   | 53 ---------------------
>  drivers/gpu/drm/i915/display/intel_ddi.c    |  5 +-
>  drivers/gpu/drm/i915/display/intel_dp_aux.c | 51 ++++++++++++++++----
>  4 files changed, 50 insertions(+), 62 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/display/g4x_dp.c
> index 0cab5992e3da..4c7187f7913e 100644
> --- a/drivers/gpu/drm/i915/display/g4x_dp.c
> +++ b/drivers/gpu/drm/i915/display/g4x_dp.c
> @@ -1378,6 +1378,9 @@ bool g4x_dp_init(struct drm_i915_private *dev_priv,
>  		intel_infoframe_init(dig_port);
>  
>  	dig_port->aux_ch = intel_dp_aux_ch(intel_encoder);
> +	if (dig_port->aux_ch == AUX_CH_NONE)
> +		goto err_init_connector;
> +
>  	if (!intel_dp_init_connector(dig_port, intel_connector))
>  		goto err_init_connector;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 439ab5b3cbe5..d1bf725ee9b3 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -2230,56 +2230,6 @@ static u8 map_ddc_pin(struct drm_i915_private *i915, u8 vbt_pin)
>  	return 0;
>  }
>  
> -static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
> -{
> -	enum port port;
> -
> -	if (!aux_ch)
> -		return PORT_NONE;
> -
> -	for_each_port(port) {
> -		const struct intel_bios_encoder_data *devdata =
> -			i915->display.vbt.ports[port];
> -
> -		if (devdata && aux_ch == devdata->child.aux_channel)
> -			return port;
> -	}
> -
> -	return PORT_NONE;
> -}
> -
> -static void sanitize_aux_ch(struct intel_bios_encoder_data *devdata,
> -			    enum port port)
> -{
> -	struct drm_i915_private *i915 = devdata->i915;
> -	struct child_device_config *child;
> -	enum port p;
> -
> -	p = get_port_by_aux_ch(i915, devdata->child.aux_channel);
> -	if (p == PORT_NONE)
> -		return;
> -
> -	drm_dbg_kms(&i915->drm,
> -		    "port %c trying to use the same AUX CH (0x%x) as port %c, "
> -		    "disabling port %c DP support\n",
> -		    port_name(port), devdata->child.aux_channel,
> -		    port_name(p), port_name(p));
> -
> -	/*
> -	 * If we have multiple ports supposedly sharing the aux channel, then DP
> -	 * couldn't exist on the shared port. Otherwise they share the same aux
> -	 * channel and system couldn't communicate with them separately.
> -	 *
> -	 * Give inverse child device order the priority, last one wins. Yes,
> -	 * there are real machines (eg. Asrock B250M-HDV) where VBT has both
> -	 * port A and port E with the same AUX ch and we must pick port E :(
> -	 */
> -	child = &i915->display.vbt.ports[p]->child;
> -
> -	child->device_type &= ~DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> -	child->aux_channel = 0;
> -}
> -
>  static u8 dvo_port_type(u8 dvo_port)
>  {
>  	switch (dvo_port) {
> @@ -2687,9 +2637,6 @@ static void parse_ddi_port(struct intel_bios_encoder_data *devdata)
>  
>  	sanitize_device_type(devdata, port);
>  
> -	if (intel_bios_encoder_supports_dp(devdata))
> -		sanitize_aux_ch(devdata, port);
> -
>  	i915->display.vbt.ports[port] = devdata;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 662b5ceef3c8..9e4e6482aa26 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4938,8 +4938,11 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	dig_port->dp.output_reg = INVALID_MMIO_REG;
>  	dig_port->max_lanes = intel_ddi_max_lanes(dig_port);
>  
> -	if (need_aux_ch(encoder, init_dp))
> +	if (need_aux_ch(encoder, init_dp)) {
>  		dig_port->aux_ch = intel_dp_aux_ch(encoder);
> +		if (dig_port->aux_ch == AUX_CH_NONE)
> +			goto err;
> +	}
>  
>  	if (intel_phy_is_tc(dev_priv, phy)) {
>  		bool is_legacy =
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
> index 21b50a5c8a85..2d173bd495a3 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
> @@ -792,25 +792,60 @@ static enum aux_ch default_aux_ch(struct intel_encoder *encoder)
>  	return (enum aux_ch)encoder->port;
>  }
>  
> +static struct intel_encoder *
> +get_encoder_by_aux_ch(struct intel_encoder *encoder,
> +		      enum aux_ch aux_ch)
> +{
> +	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> +	struct intel_encoder *other;
> +
> +	for_each_intel_encoder(&i915->drm, other) {
> +		if (other == encoder)
> +			continue;
> +
> +		if (!intel_encoder_is_dig_port(other))
> +			continue;
> +
> +		if (enc_to_dig_port(other)->aux_ch == aux_ch)
> +			return other;
> +	}
> +
> +	return NULL;
> +}
> +
>  enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder)
>  {
>  	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> +	struct intel_encoder *other;
> +	const char *source;
>  	enum aux_ch aux_ch;
>  
>  	aux_ch = intel_bios_dp_aux_ch(encoder->devdata);
> -	if (aux_ch != AUX_CH_NONE) {
> -		drm_dbg_kms(&i915->drm, "[ENCODER:%d:%s] using AUX %c (VBT)\n",
> -			    encoder->base.base.id, encoder->base.name,
> -			    aux_ch_name(aux_ch));
> -		return aux_ch;
> +	source = "VBT";
> +
> +	if (aux_ch == AUX_CH_NONE) {
> +		aux_ch = default_aux_ch(encoder);
> +		source = "platform default";
>  	}
>  
> -	aux_ch = default_aux_ch(encoder);
> +	if (aux_ch == AUX_CH_NONE)
> +		return AUX_CH_NONE;
> +
> +	/* FIXME validate aux_ch against platform caps */
> +
> +	other = get_encoder_by_aux_ch(encoder, aux_ch);
> +	if (other) {
> +		drm_dbg_kms(&i915->drm,
> +			    "[ENCODER:%d:%s] AUX CH %c already claimed by [ENCODER:%d:%s]\n",
> +			    encoder->base.base.id, encoder->base.name, aux_ch_name(aux_ch),
> +			    other->base.base.id, other->base.name);
> +		return AUX_CH_NONE;
> +	}
>  
>  	drm_dbg_kms(&i915->drm,
> -		    "[ENCODER:%d:%s] using AUX %c (platform default)\n",
> +		    "[ENCODER:%d:%s] Using AUX CH %c (%s)\n",
>  		    encoder->base.base.id, encoder->base.name,
> -		    aux_ch_name(aux_ch));
> +		    aux_ch_name(aux_ch), source);
>  
>  	return aux_ch;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-06-21  8:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 17:32 [Intel-gfx] [PATCH v2 0/5] drm/i915: Init DDI ports in VBT order Ville Syrjala
2023-06-20 17:32 ` [Intel-gfx] [PATCH v2 1/5] drm/i915: Initialize dig_port->aux_ch to NONE to be sure Ville Syrjala
2023-06-21  7:44   ` Jani Nikula
2023-06-20 17:32 ` [Intel-gfx] [PATCH v2 2/5] drm/i915: Only populate aux_ch is really needed Ville Syrjala
2023-06-21  7:46   ` Jani Nikula
2023-06-21  7:47     ` Jani Nikula
2023-06-20 17:32 ` [Intel-gfx] [PATCH v2 3/5] drm/i915: Remove DDC pin sanitation Ville Syrjala
2023-06-21  7:56   ` Jani Nikula
2023-06-29 14:04     ` Ville Syrjälä
2023-06-20 17:32 ` [Intel-gfx] [PATCH v2 4/5] drm/i915: Remove AUX CH sanitation Ville Syrjala
2023-06-21  8:00   ` Jani Nikula [this message]
2023-06-21 13:13     ` Ville Syrjälä
2023-06-20 17:32 ` [Intel-gfx] [PATCH v2 5/5] drm/i915: Try to initialize DDI/ICL+ DSI ports for every VBT child device Ville Syrjala
2023-06-26 13:06   ` Jani Nikula
2023-06-29 14:13     ` Ville Syrjälä
2023-06-20 21:30 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Init DDI ports in VBT order (rev4) Patchwork
2023-06-20 21:30 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-06-20 21:44 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-06-21  5:42 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=874jn1fdnk.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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