From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D21BF606A322 for ; Thu, 3 Dec 2026 18:21:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bc86xgk5 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B28710E12E; Thu, 3 Dec 2026 18:21:39 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F7E610E809 for ; Thu, 3 Dec 2026 18:21:33 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3F33260136; Thu, 3 Dec 2026 18:21:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D63A21F000C1; Thu, 3 Dec 2026 18:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796322092; bh=XpE3AtH9bizIoBrM2EtgksnZM41cGsE1nOLMaArrdKc=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Bc86xgk5SQXIuXlcub5ICIX4Ns0QV1VGFePcXSE9d98V541UZ7Z1DEBO1yAgC/MbO RRlFyAeVJq3fvWBeBkC9h8wmr9NEiFwcwbatu/Ey3yr3p93Bh2AEEvd4yTDSgbs19j pK1D5tZY8w5lZuz+hEDbTgSXvUiYQYE5R4NIxSeNO8MFC3uN5dSJrMkXjE29KyMWFr Z/atcvqvOZgToMjs+v2MwJJ9jecPYgUqnyXwiM58Ej9OoxTrSmUmO4XDNKzTs9Vgu2 /qy4SdPqY1Lopvl3Ugr/J7uso5ANPDgPtsuka+GXsok8ZegVGofq4GUuXIw1HrTJ5R 9b9ZpF8levY+Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/edid: Don't prefer reduced blanking for standard timings on EDID < 1.4 To: "Eriksen Xie" , dri-devel@lists.freedesktop.org In-Reply-To: <20261203170755.3958928-1-xiaolu.xie@intel.com> References: <20261203170755.3958928-1-xiaolu.xie@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 18:21:31 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 > 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 reduc= ed-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 [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 reduc= ed-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; > } > =20 > +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 =3D data; > + > + if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_RANGE)) > + return; > + > + closure->found =3D true; > + closure->in_range =3D mode_in_range(closure->mode, closure->drm_edid, t= iming); > +} [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_edi= d, > + const struct drm_display_mode *mode) > +{ > + struct std_dmt_range_closure closure =3D { > + .mode =3D mode, > + .drm_edid =3D 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 |=3D mode_in_range(...) handles both. [ ... ] > @@ -3473,6 +3512,21 @@ static struct drm_display_mode *drm_mode_std(struc= t drm_connector *connector, > =20 > /* 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 =3D 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 =3D 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 =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203170755.3958= 928-1-xiaolu.xie@intel.com?part=3D1