All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Mario Kleiner <mario.kleiner.de@gmail.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/dp: Add dpcd link_rate quirk for Apple 15" MBP 2017 (v2)
Date: Thu, 05 Mar 2020 10:35:34 +0200	[thread overview]
Message-ID: <87zhcvnqqx.fsf@intel.com> (raw)
In-Reply-To: <20200305081219.2900-1-mario.kleiner.de@gmail.com>

On Thu, 05 Mar 2020, Mario Kleiner <mario.kleiner.de@gmail.com> wrote:
> This fixes a problem found on the MacBookPro 2017 Retina panel.
>
> The panel reports 10 bpc color depth in its EDID, and the
> firmware chooses link settings at boot which support enough
> bandwidth for 10 bpc (324000 kbit/sec = multiplier 0xc),
> but the DP_MAX_LINK_RATE dpcd register only reports
> 2.7 Gbps (multiplier value 0xa) as possible, in direct
> contradiction of what the firmware successfully set up.
>
> This restricts the panel to 8 bpc, not providing the full
> color depth of the panel.
>
> This patch adds a quirk specific to the MBP 2017 15" Retina
> panel to add the additiional 324000 kbps link rate during
> edp setup.
>
> Link to previous discussion of a different attempted fix
> with Ville and Jani:
>
> https://patchwork.kernel.org/patch/11325935/
>
> v2: Follow Jani's proposal of defining quirk_rates[] instead
>     of just appending 324000. This for better clarity.
>
> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>

As much as I dislike quirks, I think we did exhaust other options when
we debugged this, and this is now very nicely isolated. Thanks for the
patch.

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

I'll merge once the CI results are in, mostly to ensure this doesn't
impact other platforms, as we don't have the machine in the CI farm.

> ---
>  drivers/gpu/drm/drm_dp_helper.c         |  2 ++
>  drivers/gpu/drm/i915/display/intel_dp.c | 11 +++++++++++
>  include/drm/drm_dp_helper.h             |  7 +++++++
>  3 files changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 5a103e9b3c86..36a371c016cb 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -1179,6 +1179,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = {
>  	{ OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) },
>  	/* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */
>  	{ OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) },
> +	/* Apple MacBookPro 2017 15 inch eDP Retina panel reports too low DP_MAX_LINK_RATE */
> +	{ OUI(0x00, 0x10, 0xfa), DEVICE_ID(101, 68, 21, 101, 98, 97), false, BIT(DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS) },
>  };
>  
>  #undef OUI
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 4074d83b1a5f..c0d2c70b04fb 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -169,6 +169,17 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
>  	};
>  	int i, max_rate;
>  
> +	if (drm_dp_has_quirk(&intel_dp->desc,
> +			     DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS)) {
> +		/* Needed, e.g., for Apple MBP 2017, 15 inch eDP Retina panel */
> +		static const int quirk_rates[] = { 162000, 270000, 324000 };
> +
> +		memcpy(intel_dp->sink_rates, quirk_rates, sizeof(quirk_rates));
> +		intel_dp->num_sink_rates = ARRAY_SIZE(quirk_rates);
> +
> +		return;
> +	}
> +
>  	max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]);
>  
>  	for (i = 0; i < ARRAY_SIZE(dp_rates); i++) {
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 262faf9e5e94..4b86a1f2a559 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -1532,6 +1532,13 @@ enum drm_dp_quirk {
>  	 * The DSC caps can be read from the physical aux instead.
>  	 */
>  	DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD,
> +	/**
> +	 * @DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS:
> +	 *
> +	 * The device supports a link rate of 3.24 Gbps (multiplier 0xc) despite
> +	 * the DP_MAX_LINK_RATE register reporting a lower max multiplier.
> +	 */
> +	DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS,
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com>
To: Mario Kleiner <mario.kleiner.de@gmail.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: Add dpcd link_rate quirk for Apple 15" MBP 2017 (v2)
Date: Thu, 05 Mar 2020 10:35:34 +0200	[thread overview]
Message-ID: <87zhcvnqqx.fsf@intel.com> (raw)
In-Reply-To: <20200305081219.2900-1-mario.kleiner.de@gmail.com>

On Thu, 05 Mar 2020, Mario Kleiner <mario.kleiner.de@gmail.com> wrote:
> This fixes a problem found on the MacBookPro 2017 Retina panel.
>
> The panel reports 10 bpc color depth in its EDID, and the
> firmware chooses link settings at boot which support enough
> bandwidth for 10 bpc (324000 kbit/sec = multiplier 0xc),
> but the DP_MAX_LINK_RATE dpcd register only reports
> 2.7 Gbps (multiplier value 0xa) as possible, in direct
> contradiction of what the firmware successfully set up.
>
> This restricts the panel to 8 bpc, not providing the full
> color depth of the panel.
>
> This patch adds a quirk specific to the MBP 2017 15" Retina
> panel to add the additiional 324000 kbps link rate during
> edp setup.
>
> Link to previous discussion of a different attempted fix
> with Ville and Jani:
>
> https://patchwork.kernel.org/patch/11325935/
>
> v2: Follow Jani's proposal of defining quirk_rates[] instead
>     of just appending 324000. This for better clarity.
>
> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>

As much as I dislike quirks, I think we did exhaust other options when
we debugged this, and this is now very nicely isolated. Thanks for the
patch.

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

I'll merge once the CI results are in, mostly to ensure this doesn't
impact other platforms, as we don't have the machine in the CI farm.

> ---
>  drivers/gpu/drm/drm_dp_helper.c         |  2 ++
>  drivers/gpu/drm/i915/display/intel_dp.c | 11 +++++++++++
>  include/drm/drm_dp_helper.h             |  7 +++++++
>  3 files changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 5a103e9b3c86..36a371c016cb 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -1179,6 +1179,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = {
>  	{ OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) },
>  	/* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */
>  	{ OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) },
> +	/* Apple MacBookPro 2017 15 inch eDP Retina panel reports too low DP_MAX_LINK_RATE */
> +	{ OUI(0x00, 0x10, 0xfa), DEVICE_ID(101, 68, 21, 101, 98, 97), false, BIT(DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS) },
>  };
>  
>  #undef OUI
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 4074d83b1a5f..c0d2c70b04fb 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -169,6 +169,17 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
>  	};
>  	int i, max_rate;
>  
> +	if (drm_dp_has_quirk(&intel_dp->desc,
> +			     DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS)) {
> +		/* Needed, e.g., for Apple MBP 2017, 15 inch eDP Retina panel */
> +		static const int quirk_rates[] = { 162000, 270000, 324000 };
> +
> +		memcpy(intel_dp->sink_rates, quirk_rates, sizeof(quirk_rates));
> +		intel_dp->num_sink_rates = ARRAY_SIZE(quirk_rates);
> +
> +		return;
> +	}
> +
>  	max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]);
>  
>  	for (i = 0; i < ARRAY_SIZE(dp_rates); i++) {
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 262faf9e5e94..4b86a1f2a559 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -1532,6 +1532,13 @@ enum drm_dp_quirk {
>  	 * The DSC caps can be read from the physical aux instead.
>  	 */
>  	DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD,
> +	/**
> +	 * @DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS:
> +	 *
> +	 * The device supports a link rate of 3.24 Gbps (multiplier 0xc) despite
> +	 * the DP_MAX_LINK_RATE register reporting a lower max multiplier.
> +	 */
> +	DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS,
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-03-05  8:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  8:12 [PATCH] drm/i915/dp: Add dpcd link_rate quirk for Apple 15" MBP 2017 (v2) Mario Kleiner
2020-03-05  8:12 ` [Intel-gfx] " Mario Kleiner
2020-03-05  8:35 ` Jani Nikula [this message]
2020-03-05  8:35   ` Jani Nikula
2020-03-05  8:37   ` Jani Nikula
2020-03-05  8:37     ` [Intel-gfx] " Jani Nikula
2020-03-05 19:58 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/dp: Add dpcd link_rate quirk for Apple 15" MBP 2017 (rev2) Patchwork
2020-03-11 10:47   ` Jani Nikula

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=87zhcvnqqx.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mario.kleiner.de@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.