dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 11/11] drm/i915: Infer vrefresh range for eDP if the EDID omits it
Date: Sat, 27 Aug 2022 00:35:01 +0300	[thread overview]
Message-ID: <20220826213501.31490-12-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20220826213501.31490-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

A bunch of machines seem to have eDP panels where the EDID
indicates continuous frequency support but fails to actually
include the range descirptor. This violates the EDID 1.4
spec, but looks like the Windows driver just hacks around
this by just assuming that the panel supports a continuous
refresh rate range that covers all EDID reported modes.

Do the same so that we get VRR support on these machines.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6323
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 45 +++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 8d1559323412..1f3e4824d316 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -5207,6 +5207,49 @@ intel_edp_add_properties(struct intel_dp *intel_dp)
 						       fixed_mode->vdisplay);
 }
 
+/*
+ * Some VRR eDP panels violate the EDID spec and neglect
+ * to include the monitor range descriptor in the EDID.
+ * Cook up the VRR refresh rate limits based on the modes
+ * reported by the panel.
+ */
+static void
+intel_edp_infer_vrr_range(struct intel_connector *connector)
+{
+	struct drm_i915_private *i915 = to_i915(connector->base.dev);
+	struct drm_display_info *info = &connector->base.display_info;
+	const struct edid *edid = connector->edid;
+	const struct drm_display_mode *mode;
+
+	if (!HAS_VRR(i915))
+		return;
+
+	if (!edid || edid->revision < 4 ||
+	    !(edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ) ||
+	    info->vrr_range.min_vfreq || info->vrr_range.max_vfreq)
+		return;
+
+	if (list_empty(&connector->base.probed_modes))
+		return;
+
+	info->vrr_range.min_vfreq = ~0;
+	info->vrr_range.max_vfreq = 0;
+
+	list_for_each_entry(mode, &connector->base.probed_modes, head) {
+		int vrefresh = drm_mode_vrefresh(mode);
+
+		info->vrr_range.min_vfreq = min_t(int, vrefresh,
+						  info->vrr_range.min_vfreq);
+		info->vrr_range.max_vfreq = max_t(int, vrefresh,
+						  info->vrr_range.max_vfreq);
+	}
+
+	drm_dbg_kms(&i915->drm,
+		    "[CONNECTOR:%d:%s] does not report refresh rate range, assuming: %d Hz - %d Hz\n",
+		    connector->base.base.id, connector->base.name,
+		    info->vrr_range.min_vfreq, info->vrr_range.max_vfreq);
+}
+
 static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 				     struct intel_connector *intel_connector)
 {
@@ -5271,6 +5314,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	}
 	intel_connector->edid = edid;
 
+	intel_edp_infer_vrr_range(intel_connector);
+
 	intel_bios_init_panel(dev_priv, &intel_connector->panel,
 			      encoder->devdata, IS_ERR(edid) ? NULL : edid);
 
-- 
2.35.1


  parent reply	other threads:[~2022-08-26 21:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 21:34 [PATCH 00/11] drm/edid: Range descriptor stuff Ville Syrjala
2022-08-26 21:34 ` [PATCH 01/11] drm/edid: Handle EDID 1.4 range descriptor h/vfreq offsets Ville Syrjala
2022-08-27  1:40   ` Navare, Manasi
2022-09-02 13:44     ` Ville Syrjälä
2022-08-26 21:34 ` [PATCH 02/11] drm/edid: Clarify why we only accept the "range limits only" descriptor Ville Syrjala
2022-08-27  1:45   ` Navare, Manasi
2022-08-26 21:34 ` [PATCH 03/11] drm/edid: s/monitor_rage/vrr_range/ Ville Syrjala
2022-08-27  1:47   ` Navare, Manasi
2022-08-29  8:29   ` [Intel-gfx] " Jani Nikula
2022-08-26 21:34 ` [PATCH 04/11] drm/edid: Define more flags Ville Syrjala
2022-08-29  8:39   ` [Intel-gfx] " Jani Nikula
2022-08-26 21:34 ` [PATCH 05/11] drm/edid: Only parse VRR range for continuous frequency displays Ville Syrjala
2022-08-29  8:58   ` Jani Nikula
2022-08-26 21:34 ` [PATCH 06/11] drm/edid: Extract drm_gtf2_mode() Ville Syrjala
2022-08-29  8:45   ` [Intel-gfx] " Jani Nikula
2022-08-26 21:34 ` [PATCH 07/11] drm/edid: Use GTF2 for inferred modes Ville Syrjala
2022-09-02 12:25   ` [Intel-gfx] " Jani Nikula
2022-09-02 12:45     ` Ville Syrjälä
2022-08-26 21:34 ` [PATCH 08/11] drm/edid: Use the correct formula for standard timings Ville Syrjala
2022-09-02 13:41   ` [Intel-gfx] " Jani Nikula
2022-09-02 14:02     ` Ville Syrjälä
2022-08-26 21:34 ` [PATCH 09/11] drm/edid: Unconfuse preferred timing stuff a bit Ville Syrjala
2022-09-02 12:27   ` Jani Nikula
2022-08-26 21:35 ` [PATCH 10/11] drm/edid: Make version checks less convoluted Ville Syrjala
2022-09-02 12:31   ` Jani Nikula
2022-08-26 21:35 ` Ville Syrjala [this message]
2022-08-29  8:56   ` [Intel-gfx] [PATCH 11/11] drm/i915: Infer vrefresh range for eDP if the EDID omits it Jani Nikula
2022-08-29 12:02   ` [PATCH v2 " Ville Syrjala

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=20220826213501.31490-12-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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).