All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/bridge: Fail an unsatisfiable bus format negotiation with -EINVAL
Date: Tue, 10 Nov 2026 07:29:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-206493@kernel.org> (raw)
In-Reply-To: <20261110-drm-bridge-busfmt-einval-v1-1-c0494bd23264@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/bridge: drm_test_bridge_rgb_yuv_no_path() fails due to
  -ENOTSUPP change
- [Low] drm/bridge: missing Fixes: trailer on commit fixing -ENOTSUPP
  leak
--

commit 13f296e3d34a65b76d6c2d283252f11982c4fa06
Author: Arun Iyengar <aiyengar1990@gmail.com>

> drm/bridge: Fail an unsatisfiable bus format negotiation with -EINVAL
>
> drm_atomic_bridge_chain_select_bus_fmts() reports that no chain of bus
> formats fits with -ENOTSUPP, and drm_atomic_bridge_chain_check() passes
> that straight back through drm_atomic_helper_check_modeset() to the
> atomic and legacy modeset ioctls. -ENOTSUPP (524) is a kernel-internal
> code that userspace does not know; for a configuration the hardware
> cannot do the atomic API returns -EINVAL. Since the connector "color
> format" property makes the negotiation fail for any requested format a
> bridge chain cannot output, userspace now hits this routinely: a DW DP
> connector asked for YCbCr 4:2:0 on a sink without 4:2:0 support gets
> here with no matching format and would fail the atomic commit with
> errno 524, where an HDMI connector asked for the same returns EINVAL
> from the HDMI state helper.
>
> Return -EINVAL when the negotiation finds no chain, with a debug
> message naming the encoder.
>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

[Severity: Low]
Since this fixes leaking -ENOTSUPP to userspace during bus format
negotiation, should it include a Fixes: tag?

  Fixes: f32df58acc68 ("drm/bridge: Add the necessary bits to support bus format negotiation")

> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 8ae2f9b1db442..6a97b579c604c 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -1437,6 +1437,17 @@ int drm_atomic_bridge_chain_check(struct drm_bridge *bridge,
>  
>  	ret = drm_atomic_bridge_chain_select_bus_fmts(bridge, crtc_state,
>  						      conn_state);
> +	/*
> +	 * -ENOTSUPP is the internal "no bus format chain" code of the
> +	 * negotiation. It is not a valid userspace error code; an atomic
> +	 * check that cannot be satisfied fails with -EINVAL.
> +	 */
> +	if (ret == -ENOTSUPP) {
> +		drm_dbg_atomic(bridge->dev,
> +			       "[ENCODER:%d:%s] no bus format chain found\n",
> +			       bridge->encoder->base.id, bridge->encoder->name);
> +		return -EINVAL;
> +	}
>  	if (ret)
>  		return ret;

[Severity: Medium]
Does drm_test_bridge_rgb_yuv_no_path() also need to be updated to expect
-EINVAL?

drivers/gpu/drm/tests/drm_bridge_test.c:drm_test_bridge_rgb_yuv_no_path() {
    ...
	ret = drm_atomic_commit(state);
	if (ret == -EDEADLK) {
		drm_modeset_backoff(&ctx);
		goto retry_commit;
	}
	KUNIT_EXPECT_EQ(test, ret, -ENOTSUPP);
    ...
}

Because drm_atomic_commit() calls into drm_atomic_bridge_chain_check(), this
KUnit test now receives -EINVAL when no valid bridge bus format path exists
and fails the -ENOTSUPP assertion.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-drm-bridge-busfmt-einval-v1-1-c0494bd23264@gmail.com?part=1

      reply	other threads:[~2026-11-10  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  7:19 [PATCH] drm/bridge: Fail an unsatisfiable bus format negotiation with -EINVAL Arun Iyengar
2026-11-10  7:19 ` Arun Iyengar via B4 Relay
2026-11-10  7:29 ` sashiko-bot [this message]

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-206493@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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.