mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4
@ 2026-12-03 17:07 Eriksen Xie
  2026-12-03 20:23 ` Jani Nikula
  0 siblings, 1 reply; 2+ messages in thread
From: Eriksen Xie @ 2026-12-03 17:07 UTC (permalink / raw)
  To: dri-devel
  Cc: Jani Nikula, Ville Syrjälä,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, linux-kernel, Eriksen Xie

drm_monitor_supports_rb() can only read the reduced blanking flag from
the range limits descriptor on EDID 1.4. For older EDIDs it just assumes
that every digital sink supports reduced blanking.

drm_mode_std() uses that to prefer the reduced blanking variant of a
standard timing. The preference was added by
commit f6e252bac45c ("drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes")
and only took effect once
commit 383a6d5fdd9a ("drm/edid: Add the reduced blanking DMT modes to the DMT list")
added the RB entries to the DMT table.

As a result a sink that lists, for example, 1920x1200@60 as a standard
timing (DMT 0x45, 193.25 MHz) gets DMT 0x44 (154.0 MHz, RB) instead,
even if its EDID is 1.3 with only GTF range limits and never claims RB
support. 1680x1050@60 and 1280x800@60 are replaced the same way. A DELL
P2715Q (EDID 1.3) is one such sink.

Where the support is only a guess, keep the plain DMT mode if it is
within the sink's range limits and only fall back to the reduced
blanking mode when it is not, or when there is no range limits
descriptor. That keeps RB for sinks that need it to fit their pixel
clock limit. EDID 1.4 sinks that explicitly declare reduced blanking are
unchanged.

Signed-off-by: Eriksen Xie <xiaolu.xie@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 54 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b8f882a17..a657da8c5 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3402,6 +3402,45 @@ drm_gtf2_mode(struct drm_device *dev,
 	return mode;
 }
 
+static bool mode_in_range(const struct drm_display_mode *mode,
+			  const struct drm_edid *drm_edid,
+			  const struct detailed_timing *timing);
+
+struct std_dmt_range_closure {
+	const struct drm_display_mode *mode;
+	const struct drm_edid *drm_edid;
+	bool found;
+	bool in_range;
+};
+
+static void std_dmt_in_range(const struct detailed_timing *timing, void *data)
+{
+	struct std_dmt_range_closure *closure = data;
+
+	if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_RANGE))
+		return;
+
+	closure->found = true;
+	closure->in_range = mode_in_range(closure->mode, closure->drm_edid, timing);
+}
+
+/*
+ * True only if the sink has a range limits descriptor and the plain
+ * (non-reduced-blanking) DMT mode is inside it.
+ */
+static bool std_dmt_mode_in_monitor_range(const struct drm_edid *drm_edid,
+					  const struct drm_display_mode *mode)
+{
+	struct std_dmt_range_closure closure = {
+		.mode = mode,
+		.drm_edid = drm_edid,
+	};
+
+	drm_for_each_detailed_block(drm_edid, std_dmt_in_range, &closure);
+
+	return closure.found && closure.in_range;
+}
+
 /*
  * Take the standard timing params (in this case width, aspect, and refresh)
  * and convert them into a real mode using CVT/GTF/DMT.
@@ -3473,6 +3512,21 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector,
 
 	/* check whether it can be found in default mode table */
 	if (drm_monitor_supports_rb(drm_edid)) {
+		/*
+		 * Before EDID 1.4 reduced blanking support is only guessed, so
+		 * don't let the guess replace the timing the sink listed: keep
+		 * the plain DMT mode if it is within the sink's range limits.
+		 */
+		if (drm_edid->edid->revision < 4) {
+			mode = drm_mode_find_dmt(dev, hsize, vsize,
+						 vrefresh_rate, false);
+			if (mode) {
+				if (std_dmt_mode_in_monitor_range(drm_edid, mode))
+					return mode;
+				drm_mode_destroy(dev, mode);
+			}
+		}
+
 		mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate,
 					 true);
 		if (mode)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4
  2026-12-03 17:07 [PATCH] drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4 Eriksen Xie
@ 2026-12-03 20:23 ` Jani Nikula
  0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2026-12-03 20:23 UTC (permalink / raw)
  To: Eriksen Xie, dri-devel
  Cc: Ville Syrjälä,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, linux-kernel, Eriksen Xie

On Fri, 04 Dec 2026, Eriksen Xie <xiaolu.xie@intel.com> wrote:
> drm_monitor_supports_rb() can only read the reduced blanking flag from
> the range limits descriptor on EDID 1.4. For older EDIDs it just assumes
> that every digital sink supports reduced blanking.
>
> drm_mode_std() uses that to prefer the reduced blanking variant of a
> standard timing. The preference was added by
> commit f6e252bac45c ("drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes")
> and only took effect once
> commit 383a6d5fdd9a ("drm/edid: Add the reduced blanking DMT modes to the DMT list")
> added the RB entries to the DMT table.
>
> As a result a sink that lists, for example, 1920x1200@60 as a standard
> timing (DMT 0x45, 193.25 MHz) gets DMT 0x44 (154.0 MHz, RB) instead,
> even if its EDID is 1.3 with only GTF range limits and never claims RB
> support. 1680x1050@60 and 1280x800@60 are replaced the same way. A DELL
> P2715Q (EDID 1.3) is one such sink.

Please share the EDID. We might as well add the EDID in the commit
message.

BR,
Jani.

>
> Where the support is only a guess, keep the plain DMT mode if it is
> within the sink's range limits and only fall back to the reduced
> blanking mode when it is not, or when there is no range limits
> descriptor. That keeps RB for sinks that need it to fit their pixel
> clock limit. EDID 1.4 sinks that explicitly declare reduced blanking are
> unchanged.
>
> Signed-off-by: Eriksen Xie <xiaolu.xie@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 54 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index b8f882a17..a657da8c5 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3402,6 +3402,45 @@ drm_gtf2_mode(struct drm_device *dev,
>  	return mode;
>  }
>  
> +static bool mode_in_range(const struct drm_display_mode *mode,
> +			  const struct drm_edid *drm_edid,
> +			  const struct detailed_timing *timing);
> +
> +struct std_dmt_range_closure {
> +	const struct drm_display_mode *mode;
> +	const struct drm_edid *drm_edid;
> +	bool found;
> +	bool in_range;
> +};
> +
> +static void std_dmt_in_range(const struct detailed_timing *timing, void *data)
> +{
> +	struct std_dmt_range_closure *closure = data;
> +
> +	if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_RANGE))
> +		return;
> +
> +	closure->found = true;
> +	closure->in_range = mode_in_range(closure->mode, closure->drm_edid, timing);
> +}
> +
> +/*
> + * True only if the sink has a range limits descriptor and the plain
> + * (non-reduced-blanking) DMT mode is inside it.
> + */
> +static bool std_dmt_mode_in_monitor_range(const struct drm_edid *drm_edid,
> +					  const struct drm_display_mode *mode)
> +{
> +	struct std_dmt_range_closure closure = {
> +		.mode = mode,
> +		.drm_edid = drm_edid,
> +	};
> +
> +	drm_for_each_detailed_block(drm_edid, std_dmt_in_range, &closure);
> +
> +	return closure.found && closure.in_range;
> +}
> +
>  /*
>   * Take the standard timing params (in this case width, aspect, and refresh)
>   * and convert them into a real mode using CVT/GTF/DMT.
> @@ -3473,6 +3512,21 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector,
>  
>  	/* check whether it can be found in default mode table */
>  	if (drm_monitor_supports_rb(drm_edid)) {
> +		/*
> +		 * Before EDID 1.4 reduced blanking support is only guessed, so
> +		 * don't let the guess replace the timing the sink listed: keep
> +		 * the plain DMT mode if it is within the sink's range limits.
> +		 */
> +		if (drm_edid->edid->revision < 4) {
> +			mode = drm_mode_find_dmt(dev, hsize, vsize,
> +						 vrefresh_rate, false);
> +			if (mode) {
> +				if (std_dmt_mode_in_monitor_range(drm_edid, mode))
> +					return mode;
> +				drm_mode_destroy(dev, mode);
> +			}
> +		}
> +
>  		mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate,
>  					 true);
>  		if (mode)

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 17:07 [PATCH] drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4 Eriksen Xie
2026-12-03 20:23 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®