All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 38/39] drm/panel: Implement state readout support
Date: Fri, 06 Nov 2026 13:45:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-201494@kernel.org> (raw)
In-Reply-To: <20261106-drm-state-readout-v8-38-cbe78624e1bc@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/panel: active readout in panel_bridge_connector_readout()
  desyncs drm_panel
- [Medium] drm/panel: panel_bridge_connector_readout() returns -ENODEV
  on inactive CRTC
--

commit 64e424167a6978d4eae36faa89c4949c44fe1a60
Author: Maxime Ripard <mripard@kernel.org>

drm/panel: Implement state readout support

This commit implements atomic state readout callbacks for the panel bridge,
reconstructing the negotiated bus configuration and binding the connector
to the encoder's active CRTC when no earlier bridge provides connector
readout.

> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 560ea57591bd7..bef0e6af73ba5 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c

[ ... ]

> @@ -226,6 +252,100 @@ static void panel_bridge_debugfs_init(struct drm_bridge *bridge,
>  		panel->funcs->debugfs_init(panel, root);
>  }
>  

[ ... ]

> +/*
> + * A panel bridge has no way to read the panel state out of the
> + * hardware: assume the panel is enabled whenever its pipeline is.
> + */
> +static int
> +panel_bridge_connector_readout(struct drm_bridge *bridge,
> +			       struct drm_atomic_sro_state *state,
> +			       struct drm_connector_state *conn_state)
> +{
> +	struct drm_connector *connector = conn_state->connector;
> +	struct drm_crtc_state *crtc_state;
> +	struct drm_encoder *encoder;
> +	struct drm_crtc *crtc;
> +
> +	encoder = bridge->encoder;
> +	if (!encoder->funcs || !encoder->funcs->atomic_sro_get_current_crtc)
> +		return -ENODEV;
> +
> +	crtc = encoder->funcs->atomic_sro_get_current_crtc(encoder);
> +	if (!crtc)
> +		return -ENODEV;
> +
> +	crtc_state = drm_atomic_sro_get_crtc_state(state, crtc);
> +	if (!crtc_state)
> +		return -ENODEV;

[Severity: Medium]
Should panel_bridge_connector_readout() return 0 instead of -ENODEV when
crtc or crtc_state is NULL?

In include/drm/drm_encoder.h, atomic_sro_get_current_crtc() is documented
to return NULL when the encoder is disabled.  In addition, during a
commit-scoped readout in drm_atomic_sro_readout_and_compare() that touches
a disabled connector without including its CRTC in the commit,
drm_atomic_sro_get_crtc_state() returns NULL.  Returning -ENODEV in these
cases causes drm_atomic_helper_sro_build_state() to fail readout when the
pipeline is off.

> +
> +	/* The pipeline is off, there is nothing to read out. */
> +	if (!crtc_state->active)
> +		return 0;
> +
> +	crtc_state->encoder_mask |= drm_encoder_mask(encoder);
> +	crtc_state->connector_mask |= drm_connector_mask(connector);
> +
> +	/*
> +	 * drm_atomic_set_crtc_for_connector() takes a connector
> +	 * reference when setting the crtc pointer, which is later
> +	 * released by __drm_atomic_helper_connector_destroy_state().
> +	 * The readout bypasses that path, so take the reference
> +	 * explicitly.
> +	 */
> +	drm_connector_get(connector);
> +	conn_state->crtc = crtc;
> +	conn_state->best_encoder = encoder;
> +
> +	return 0;
> +}

[Severity: High]
When a pipeline is read out as active, does binding conn_state to the CRTC
without preparing or enabling the underlying struct drm_panel leave
panel->prepared and panel->enabled out of sync with the atomic state?

Nothing in the state installation path calls drm_panel_prepare() or
drm_panel_enable().  On a subsequent fastboot commit where
drm_atomic_crtc_needs_modeset() is false, panel_bridge_atomic_pre_enable()
and panel_bridge_atomic_enable() are skipped, so the panel's regulators,
clocks, backlight and followers are never enabled in the kernel.  When a
later commit disables the pipeline, panel_bridge_atomic_disable() and
panel_bridge_atomic_post_disable() call drm_panel_disable() and
drm_panel_unprepare(), which hit the !panel->enabled and !panel->prepared
guards, log a warning and skip hardware teardown.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-drm-state-readout-v8-0-cbe78624e1bc@kernel.org?part=38

  reply	other threads:[~2026-11-06 13:46 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
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 [this message]
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-201494@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.