Re: [PATCH v2 3/3] drm/msm/dp: validate modes against the trained link, not the sink's claim

From: Dmitry Baryshkov

Date: Fri Nov 27 2026 - 06:53:51 EST


On Mon, Oct 05, 2026 at 05:56:15PM +0200, Jean-Francois Bobier wrote:
> msm_dp_display_mode_valid() sizes every mode against
> panel->link_info, which is what the sink advertises in DPCD. That is not
> necessarily what the link carries. msm_dp_ctrl_on_link() walks the rate
> down HBR3 -> HBR2 -> HBR -> RBR and then reduces the lane count until
> training succeeds, so a cable with two unusable lanes trains at half the
> bandwidth the sink claims.
>
> The validator does not know that, so it keeps advertising modes sized for
> the sink's maximum. Userspace picks one, training "succeeds" at the
> reduced parameters, the mode does not fit in them, and the sink shows a
> black screen -- with nothing in the log to explain it, because from the
> driver's point of view everything worked.
>
> Observed on an sm8250 phone with a 4K monitor whose cable only carries
> two lanes: the connector offers 3840x2160, the link trains at 2 lanes
> HBR2 (8.6 Gbps after 8b/10b against the 12.5 Gbps the mode needs at 24
> bpp, more at 30), and the screen stays black until the user picks
> 2560x1440 by hand.
>
> link->link_params holds the trained values, but is only meaningful for
> the sink that produced them. msm_dp_hpd_unplug_handle() now clears it on
> disconnect, and msm_dp_ctrl_on_link() resets it to the new sink's own
> maximum before training, so taking the lower of link_params and
> link_info is accurate once a sink has been trained and a safe no-op
> before that -- never the previous sink's leftover values.
>
> This does not by itself make userspace re-probe after a fallback -- that
> needs the link-status property, which cannot be set from
> msm_dp_bridge_atomic_enable() because the modeset locks are held, and is
> the deferred work the existing TODO there refers to. What it does ensure
> is that any probe after a fallback offers only modes the link can
> actually drive.
>
> Also log the rejection at debug level; a mode silently disappearing from
> the list is otherwise hard to account for.
>
> Signed-off-by: Jean-Francois Bobier <jean-francois.bobier@xxxxxxxxxxx>
> ---
> Changes in v2:
> - Clear link_params on disconnect in msm_dp_hpd_unplug_handle(), and
> updated the comment in mode_valid() to say so. v1 reset link_params to
> the sink's maximum at the start of training, but never on disconnect,
> so mode_valid() for a freshly plugged sink -- which runs during EDID
> read, before that sink's own link has ever been trained -- could size
> its modes against whatever the *previous* sink's link had trained
> down to. The num_lanes/rate == 0 guard already in v1's mode_valid()
> now does what it was presumably meant to do from the start: treat
> "not yet trained for this sink" as "don't restrict," rather than
> "not yet trained since driver load."
> - Caught by this list's automated review on v1, not by hand -- credit
> where it's due.
>
> drivers/gpu/drm/msm/dp/dp_display.c | 53 +++++++++++++++++++++++++++--
> 1 file changed, 51 insertions(+), 2 deletions(-)
>

Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support"
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>

)

--
With best wishes
Dmitry