Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>,
	<intel-xe@lists.freedesktop.org>,
	 <intel-gfx@lists.freedesktop.org>
Cc: <jani.nikula@intel.com>
Subject: Re: [PATCH v5 3/3] drm/i915/edp: eDP Data Overrride
Date: Tue, 19 Aug 2025 15:00:16 +0530	[thread overview]
Message-ID: <51425c4b-5a2c-4928-b482-b6859b86825e@intel.com> (raw)
In-Reply-To: <20250819080602.84826-4-suraj.kandpal@intel.com>


On 8/19/2025 1:36 PM, Suraj Kandpal wrote:
> We need override certain link rates in favour of the next available
> higher link rate. The Link rates that need to be overridden are
> indicated by a mask in VBT. To make sure these modes are skipped we
> don't add them in them in the sink rates array.
>
> --v2
> -Update the link rates after we have a final set of link rates [Ankit]
> -Break this patch up [Ankit]
> -Optimize the assingment during loop [Ankit]
>
> --v3
> -Add protection against broken VBTs [Jani]
>
> --v4
> -Fix build errors
> -Create a seprate function to check if edp data override is selected
> and using the correct vbt
>
> --v5
> -Use correct number to check the num of edp rates [Ankit]
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_bios.c | 15 ++++++++++++++-
>   drivers/gpu/drm/i915/display/intel_bios.h |  2 ++
>   drivers/gpu/drm/i915/display/intel_dp.c   | 22 ++++++++++++++++++++++
>   3 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 444ed54f7c35..05a74c3bc9af 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -2521,11 +2521,24 @@ int intel_bios_dp_max_lane_count(const struct intel_bios_encoder_data *devdata)
>   bool
>   intel_bios_encoder_reject_edp_rate(const struct intel_bios_encoder_data *devdata,
>   				   int rate)
> +{
> +	return devdata->child.edp_data_rate_override & edp_rate_override_mask(rate);
> +}
> +
> +bool
> +intel_bios_vbt_supports_edp_data_override(const struct intel_bios_encoder_data *devdata)
>   {
>   	if (!devdata || devdata->display->vbt.version < 263)
>   		return false;
>   
> -	return devdata->child.edp_data_rate_override & edp_rate_override_mask(rate);
> +	/*
> +	 * This means the VBT ends up asking us to override every possible rate
> +	 * indicating the VBT is broken so skip this
> +	 */
> +	if (hweight32(devdata->child.edp_data_rate_override) >= BDB_263_VBT_EDP_NUM_RATES)
> +		return false;
> +
> +	return true;
>   }


This new helper and and the change to intel_bios_encoder_reject_edp_rate 
should be part of previous patch.

>   
>   static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
> index 781e08f7eeb2..d24660bcc7f3 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.h
> +++ b/drivers/gpu/drm/i915/display/intel_bios.h
> @@ -276,5 +276,7 @@ void intel_bios_for_each_encoder(struct intel_display *display,
>   					      const struct intel_bios_encoder_data *devdata));
>   
>   void intel_bios_debugfs_register(struct intel_display *display);
> +bool
> +intel_bios_vbt_supports_edp_data_override(const struct intel_bios_encoder_data *devdata);
>   
>   #endif /* _INTEL_BIOS_H_ */
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 54d88f24b689..f6fad42182ae 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4277,6 +4277,26 @@ static void intel_edp_mso_init(struct intel_dp *intel_dp)
>   	intel_dp->mso_pixel_overlap = mso ? info->mso_pixel_overlap : 0;
>   }
>   
> +static void
> +intel_edp_set_data_override_rates(struct intel_dp *intel_dp)
> +{
> +	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
> +	int *sink_rates = intel_dp->sink_rates;
> +	int i, j = 0;
> +
> +	if (!intel_bios_vbt_supports_edp_data_override(encoder->devdata))
> +		return;
> +
> +	for (i = 0; i < intel_dp->num_sink_rates; i++) {
> +		if (intel_bios_encoder_reject_edp_rate(encoder->devdata,
> +						       intel_dp->sink_rates[i]))
> +			continue;
> +
> +		sink_rates[j++] = intel_dp->sink_rates[i];
> +	}
> +	intel_dp->num_sink_rates = j;

Perhaps `count` instead of `j` will suit better, as i, j are generally 
used as iterators , and here we are interested in the final count. But 
that should not be a deal breaker.

With the above movement of helpers in patch#2, this looks good to me.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>


> +}
> +
>   static void
>   intel_edp_set_sink_rates(struct intel_dp *intel_dp)
>   {
> @@ -4327,6 +4347,8 @@ intel_edp_set_sink_rates(struct intel_dp *intel_dp)
>   		intel_dp->use_rate_select = true;
>   	else
>   		intel_dp_set_sink_rates(intel_dp);
> +
> +	intel_edp_set_data_override_rates(intel_dp);
>   }
>   
>   static bool

  reply	other threads:[~2025-08-19  9:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19  8:05 [PATCH v5 0/3] eDP Data Override Suraj Kandpal
2025-08-19  8:06 ` [PATCH v5 1/3] drm/i915/vbt: Add eDP Data rate overrride field in VBT Suraj Kandpal
2025-08-19  9:16   ` Nautiyal, Ankit K
2025-08-19  8:06 ` [PATCH v5 2/3] drm/i915/bios: Add function to check if edp data override is needed Suraj Kandpal
2025-08-19  8:06 ` [PATCH v5 3/3] drm/i915/edp: eDP Data Overrride Suraj Kandpal
2025-08-19  9:30   ` Nautiyal, Ankit K [this message]
2025-08-19  9:41   ` Jani Nikula
2025-08-19 12:03     ` Kandpal, Suraj
2025-08-19 12:20       ` Jani Nikula
2025-08-20  8:07       ` Nautiyal, Ankit K
2025-08-19 11:31 ` ✓ CI.KUnit: success for eDP Data Override (rev6) Patchwork
2025-08-19 12:59 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-20  6:33 ` ✓ Xe.CI.Full: " 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=51425c4b-5a2c-4928-b482-b6859b86825e@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=suraj.kandpal@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