All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eriksen Xie" <xiaolu.xie@intel.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4
Date: Thu, 03 Dec 2026 18:21:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-248374@kernel.org> (raw)
In-Reply-To: <20261203170755.3958928-1-xiaolu.xie@intel.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] drm/edid: std_dmt_in_range() ignores unspecified max pixel
  clock
- [Low] drm/edid: std_dmt_in_range() overwrites in_range across range
  descriptors
- [Low] drm/edid: missing Fixes trailer for commit f6e252bac45c
- [Low] drm/edid: redundant DMT lookup and alloc/free cycle in
  drm_mode_std()
--

commit 2399ce37e3ebb2fde8967f9739e27ee27247f004
Author: Eriksen Xie <xiaolu.xie@intel.com>

> drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4
>
> 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>

[Severity: Low]
This looks like a bug fix for the reduced-blanking preference in
drm_mode_std().  Should this include:

  Fixes: f6e252bac45c ("drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes")

> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index b8f882a17c8f1..a657da8c5e2d0 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);
> +}

[Severity: Medium]
Can std_dmt_in_range() accept a plain DMT mode when the range limits
descriptor leaves the maximum pixel clock unspecified?

range_pixel_clock() returns 0 when byte 9 is 0 or 255, and
mode_in_range() skips the pixel clock check when max_clock is 0.  Plain
and RB 60 Hz DMT pairs like 1920x1200@60 (193.25 MHz vs 154.0 MHz RB)
have nearly identical hsync and vsync, so the plain mode still passes.

On an EDID < 1.4 digital sink limited by single-link DVI (165 MHz) that
leaves byte 9 unspecified, this regression causes the higher-clock plain
mode to be pruned or fail modeset instead of falling back to RB.  Should
std_dmt_in_range() require a non-zero range_pixel_clock()?

> +/*
> + * 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;
> +}

[Severity: Low]
Can std_dmt_in_range() overwrite an earlier match if an EDID has more
than one EDID_DETAIL_MONITOR_RANGE descriptor?

drm_for_each_detailed_block() visits every detailed block across the
base, CEA, and VTB blocks without stopping, so assigning
closure->in_range directly keeps only the last range descriptor's
result instead of matching if any descriptor covers the mode.

Also, closure.found is redundant because closure.in_range starts as
false and is only set inside std_dmt_in_range().  Dropping found and
using closure->in_range |= mode_in_range(...) handles both.

[ ... ]

> @@ -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)

[Severity: Low]
Does this path allocate, free, and re-allocate the same plain DMT mode
for standard timings that have no reduced-blanking DMT entry?

On an EDID < 1.4 digital sink without a range limits descriptor, a
timing like 1920x1080@60 allocates the plain mode here, walks all
detailed blocks, destroys it, finds no RB entry, and then calls
drm_mode_find_dmt() with rb = false a second time right below.

Splitting a static non-allocating DMT lookup helper out of
drm_mode_find_dmt() would let drm_mode_std() check for a competing RB
entry first, run std_dmt_mode_in_monitor_range() directly on the const
table entry, and call drm_mode_duplicate() once.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203170755.3958928-1-xiaolu.xie@intel.com?part=1

  reply	other threads:[~2026-12-03 18:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 18:21 ` sashiko-bot [this message]
2026-12-03 20:23 ` Jani Nikula
2026-12-04  2:34   ` Eriksen Xie

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=sashiko-outbox-248374@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaolu.xie@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 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.