All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Frédéric Mahé" <frederic.mahe@cirad.fr>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/nouveau/dispnv50: reject DP modes that don't fit the link
Date: Mon, 23 Nov 2026 14:30:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-229398@kernel.org> (raw)
In-Reply-To: <20261123101659.600247-3-frederic.mahe@cirad.fr>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/nouveau: incomplete DP mode check condition in
  nv50_outp_atomic_check()
--

commit 943220be5958f2da589b892e0f39c0caa93bf128
Author: Frédéric Mahé <frederic.mahe@cirad.fr>

drm/nouveau/dispnv50: reject DP modes that don't fit the link

This commit rejects DisplayPort modes in nv50_outp_atomic_check() when
nv50_dp_mode_valid() indicates that the mode exceeds the link capacity even
after reducing the bpc.

> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 98a5188f65234..d7582ed8026b1 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -423,6 +423,21 @@ nv50_outp_atomic_check(struct drm_encoder *encoder,
>  	/* We might have to reduce the bpc */
>  	nv50_outp_atomic_fix_depth(encoder, crtc_state);
>  
> +	/* Reject a mode that does not fit the DP link even at the lowest bpc:
> +	 * link training would fail and the display would stay dark.  Only
> +	 * when the link capabilities are known, so that a sink that is
> +	 * asleep or still resuming does not make every commit fail.
> +	 */
> +	if (crtc_state->mode_changed && crtc_state->active) {
> +		struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
> +
> +		if (nv_encoder->dcb->type == DCB_OUTPUT_DP &&
> +		    nv_encoder->dp.link_nr && nv_encoder->dp.link_bw &&
> +		    nv50_dp_mode_valid(nv_encoder, &crtc_state->adjusted_mode,
> +				       NULL) != MODE_OK)
> +			return -EINVAL;
> +	}

[Severity: Medium]
Should this condition be (crtc_state->mode_changed ||
crtc_state->connectors_changed), matching the bpc check earlier in
nv50_outp_atomic_check()?

If connector routing or a connector property changes without changing the
CRTC mode, crtc_state->connectors_changed is set while
crtc_state->mode_changed remains false.  This check is then skipped, even
though nv50_disp_outp_atomic_check_set() tests
drm_atomic_crtc_needs_modeset() and still enables the DP output and runs
link training with the out-of-range mode.

Also, struct drm_crtc_state documents that atomic_check callbacks must not
consult crtc_state->active to reject a commit.  Gating on crtc_state->active
allows an out-of-range mode to be committed while active is false; a later
DPMS ON commit only sets active_changed (with mode_changed false), bypassing
this check as well.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123101659.600247-1-frederic.mahe@cirad.fr?part=2

  reply	other threads:[~2026-11-23 14:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:16 [PATCH 0/2] drm/nouveau: fix crash when DP link training fails Frédéric Mahé
2026-11-23 10:16 ` Frédéric Mahé
2026-11-23 10:16 ` [PATCH 1/2] drm/nouveau/disp/nv50-: don't divide by zero when the DP link is not trained Frédéric Mahé
2026-11-23 10:16   ` Frédéric Mahé
2026-11-23 10:16 ` [PATCH 2/2] drm/nouveau/dispnv50: reject DP modes that don't fit the link Frédéric Mahé
2026-11-23 10:16   ` Frédéric Mahé
2026-11-23 14:30   ` sashiko-bot [this message]
2026-11-23 16:33 ` [PATCH 0/2] drm/nouveau: fix crash when DP link training fails Frédéric Mahé
2026-11-23 16:33   ` Frédéric Mahé

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-229398@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frederic.mahe@cirad.fr \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.