From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 25/39] drm/atomic-state-helper: Provide atomic_compare_state helpers
Date: Fri, 06 Nov 2026 13:44:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-201490@kernel.org> (raw)
In-Reply-To: <20261106-drm-state-readout-v8-25-cbe78624e1bc@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/atomic: false plane mismatches in
drm_atomic_helper_plane_compare_state()
- [Low] drm/atomic: missing crtc return in
drm_atomic_helper_connector_compare_state()
--
commit 5ada4d3fe0db996674c95e2287875ccd802a0470
Author: Maxime Ripard <mripard@kernel.org>
drm/atomic-state-helper: Provide atomic_compare_state helpers
This commit adds default atomic_sro_compare_state helper implementations
for planes, CRTCs, connectors, and bridges.
> diff --git a/drivers/gpu/drm/drm_atomic_state_readout_helper.c b/drivers/gpu/drm/drm_atomic_state_readout_helper.c
> index 4156f3a27f049..57376c9d4014b 100644
> --- a/drivers/gpu/drm/drm_atomic_state_readout_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_state_readout_helper.c
[ ... ]
> @@ -788,6 +789,311 @@ int drm_atomic_helper_sro_readout_state(struct drm_device *dev)
[ ... ]
> +bool drm_atomic_helper_plane_compare_state(struct drm_plane *plane,
> + struct drm_printer *p,
> + struct drm_plane_state *expected,
> + struct drm_plane_state *actual)
> +{
> + bool ret = true;
> +
> + STATE_CHECK_PTR(ret, p, plane->name, expected, actual, plane);
> + STATE_CHECK_PTR(ret, p, plane->name, expected, actual, crtc);
> +
> + /* Both disabled, geometry is meaningless. */
> + if (!expected->fb && !actual->fb)
> + return ret;
> +
> + /* One enabled and the other disabled, that's a mismatch. */
> + if (!expected->fb || !actual->fb) {
> + drm_atomic_helper_print_state_mismatch(p,
> + plane->name,
> + "fb",
> + "expected framebuffer is %s, got %s",
> + expected->fb ? "non-NULL" : "NULL",
> + actual->fb ? "non-NULL" : "NULL");
> + return false;
> + }
[Severity: Medium]
Does drm_atomic_helper_plane_compare_state() report false crtc and fb
mismatches when a plane is clipped off-screen or its CRTC is set to DPMS
off?
During a DPMS off commit (enable = true, active = false) or when a plane
is clipped off-screen (visible = false), expected->crtc and expected->fb
remain non-NULL in the committed state, while the hardware plane is
disabled so hardware readout produces a pristine state with actual->crtc
and actual->fb set to NULL. Unlike the connector, bridge, and CRTC paths,
neither drm_atomic_sro_readout_and_compare() nor
drm_atomic_helper_plane_compare_state() checks whether the plane is
visible or bound to an active CRTC before comparing crtc and fb, causing
drm_atomic_sro_readout_and_compare() to log false mismatches and return
false.
[ ... ]
> +bool drm_atomic_helper_connector_compare_state(struct drm_connector *conn,
> + struct drm_printer *p,
> + struct drm_connector_state *expected,
> + struct drm_connector_state *actual)
> +{
> + bool ret = true;
> +
> + STATE_CHECK_PTR(ret, p, conn->name, expected, actual, connector);
> +
> + /*
> + * Both unbound, the routing and the negotiated properties are
> + * meaningless: a disabled connector keeps the values it was
> + * last enabled with, while a state read out from a disabled
> + * pipeline is pristine.
> + */
> + if (!expected->crtc && !actual->crtc)
> + return ret;
> +
> + STATE_CHECK_PTR(ret, p, conn->name, expected, actual, crtc);
> + STATE_CHECK_PTR(ret, p, conn->name, expected, actual, best_encoder);
> + STATE_CHECK_U32(ret, p, conn->name, expected, actual, link_status);
> +
> + STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.select_subconnector);
> + STATE_CHECK_U32(ret, p, conn->name, expected, actual, tv.subconnector);
[Severity: Low]
Should drm_atomic_helper_connector_compare_state() return false right
after checking crtc when one of expected->crtc or actual->crtc is NULL?
Continuing when one state is unbound compares negotiated properties
against stale or pristine fields and logs spurious mismatches, unlike
drm_atomic_helper_plane_compare_state() and
drm_atomic_helper_crtc_compare_state().
Also, only tv.select_subconnector and tv.subconnector are compared here,
leaving the remaining struct drm_tv_connector_state fields (margins,
legacy_mode, mode, brightness, contrast, flicker_reduction, overscan,
saturation, and hue) unchecked.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-drm-state-readout-v8-0-cbe78624e1bc@kernel.org?part=25
next prev parent reply other threads:[~2026-11-06 13:44 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 13:14 [PATCH v8 00/39] drm: Implement state readout support Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 01/39] drm/ingenic: Convert to devm_drm_bridge_alloc() Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:55 ` Luca Ceresoli
2026-11-06 13:59 ` Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 02/39] drm/bridge-helper: Don't unlock the connection mutex after a backoff Maxime Ripard
2026-11-06 13:39 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 03/39] drm/tests: hdmi-state-helper: Handle EDEADLK in the 420-only test Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 04/39] drm/tests: hdmi-state-helper: Handle EDEADLK in the color format test Maxime Ripard
2026-11-06 13:32 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 05/39] drm/colorop: Export drm_atomic_helper_colorop_create_state() Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 06/39] drm/atomic: Fix private obj error handling Maxime Ripard
2026-11-06 13:29 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 07/39] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-11-06 13:35 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 08/39] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 09/39] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 10/39] drm/fb-dma-helper: Handle framebuffers without a GEM object Maxime Ripard
2026-11-06 13:32 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 11/39] drm/gem-atomic-helper: " Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 12/39] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 13/39] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 14/39] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-11-06 13:31 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 15/39] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 16/39] drm/atomic_sro: Add function to install state into drm objects Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 17/39] drm/atomic_sro: Create documentation Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 18/39] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 19/39] drm/mode-config: Read out hardware state in drm_mode_config_create_state Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 20/39] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-11-06 13:44 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 21/39] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 22/39] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 23/39] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 24/39] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 25/39] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-11-06 13:44 ` sashiko-bot [this message]
2026-11-06 13:14 ` [PATCH v8 26/39] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 27/39] drm/tests: kunit: Add a drm_printer helper Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 28/39] drm/tests: Add tests for the atomic state readout Maxime Ripard
2026-11-06 13:44 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 29/39] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 30/39] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-11-06 13:50 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 31/39] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 32/39] drm/tidss: crtc: Add atomic_print_state implementation Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 33/39] drm/tidss: dispc: Improve mode checking logs Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 34/39] drm/tidss: Implement hw_reset Maxime Ripard
2026-11-06 13:50 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 35/39] drm/tidss: Implement readout support Maxime Ripard
2026-11-06 14:06 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 36/39] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 37/39] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 38/39] drm/panel: Implement state readout support Maxime Ripard
2026-11-06 13:45 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 39/39] fixup! drm/tidss: Implement " Maxime Ripard
2026-11-06 13:57 ` sashiko-bot
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-201490@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mripard@kernel.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.