From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/6] drm/i915: Implement connector atomic_create_state
Date: Tue, 24 Nov 2026 11:21:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-231040@kernel.org> (raw)
In-Reply-To: <20261124-drm-i915-conversion-state-readout-v1-5-b7132f72644d@kernel.org>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] drm/i915: uninitialized max_bpc in
intel_digital_connector_create_state()
- [High] drm/i915: uninitialized scaling_mode in
intel_digital_connector_create_state()
- [High] drm/i915: drm_mode_config_reset() wipes connector->state on PM
resume
- [Medium] drm/i915: missing TV defaults in TV and SDVO
atomic_create_state callbacks
--
commit 2bdba76f9c13d7e52d75cab97754e24fd12b8cea
Author: Maxime Ripard <mripard@kernel.org>
drm/i915: Implement connector atomic_create_state
This commit implements the .atomic_create_state hook for all i915
connectors to support DRM_MODE_ATOMIC_RESET.
> The other atomic_create_state() users don't apply to i915: it reads
> the state the firmware left behind out of the hardware at probe time,
> so it never goes through drm_mode_config_create_initial_state() nor
> the hardware state readout helpers. The atomic reset is thus the only
> user the hook enables here.
[Severity: High]
Does wiring up connector->funcs->atomic_create_state also cause
drm_mode_config_reset() to destroy and recreate connector->state on PM
resume?
drm_mode_config_reset() calls
drm_mode_config_connector_reset_with_create_state() whenever a connector
implements atomic_create_state:
drivers/gpu/drm/drm_mode_config.c:drm_mode_config_reset() {
...
drm_connector_list_iter_begin(dev, &conn_iter);
drm_for_each_connector_iter(connector, &conn_iter) {
if (connector->funcs->atomic_create_state)
drm_mode_config_connector_reset_with_create_state(connector);
}
drm_connector_list_iter_end(&conn_iter);
}
Both i915_drm_resume() and Xe's xe_display_pm_resume() and
xe_display_disable_d3cold() call drm_mode_config_reset(). On Xe runtime
PM exit from D3cold, xe_display_disable_d3cold() runs without saving or
restoring atomic state and without holding modeset locks, so every D3cold
wakeup replaces each connector->state with a fresh default state and
wipes out existing property values and routing.
[ ... ]
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
> index b66c2d4ba2b3f..e752bbdda494c 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic.c
> @@ -170,6 +170,29 @@ intel_digital_connector_duplicate_state(struct drm_connector *connector)
> return &state->base;
> }
>
> +/**
> + * intel_digital_connector_create_state - allocate a pristine connector state
> + * @connector: digital connector
> + *
> + * Allocates and initializes a pristine &struct intel_digital_connector_state.
> + *
> + * Returns: The newly allocated connector state, or an error pointer on
> + * failure.
> + */
> +struct drm_connector_state *
> +intel_digital_connector_create_state(struct drm_connector *connector)
> +{
> + struct intel_digital_connector_state *conn_state;
> +
> + conn_state = kzalloc_obj(*conn_state);
> + if (!conn_state)
> + return ERR_PTR(-ENOMEM);
> +
> + __drm_atomic_helper_connector_state_init(&conn_state->base, connector);
> +
> + return &conn_state->base;
> +}
[Severity: High]
Does intel_digital_connector_create_state() leave
conn_state->base.max_requested_bpc and conn_state->base.max_bpc as 0 on
DP, DP MST and HDMI connectors?
At connector init, drm_connector_attach_max_bpc_property() attaches
connector->max_bpc_property and initializes max_requested_bpc and max_bpc
on the initial state, whereas __drm_atomic_helper_connector_state_init()
only sets conn_state->connector. When DRM_MODE_ATOMIC_RESET creates a
fresh state without userspace explicitly supplying the "max bpc"
property, drm_atomic_connector_check() clamps state->max_bpc to
min(state->max_bpc, state->max_requested_bpc), which is 0. During
modeset check, compute_sink_pipe_bpp() passes conn_state->max_bpc to
bpc_to_bpp(0), hitting MISSING_CASE(0) (a kernel WARN) and failing the
commit with -EINVAL.
[Severity: High]
Does intel_digital_connector_create_state() also leave
conn_state->base.scaling_mode at 0 (DRM_MODE_SCALE_NONE) on eDP, LVDS and
DSI panel connectors?
intel_attach_scaling_mode_property() attaches
connector->scaling_mode_property without DRM_MODE_SCALE_NONE in the
supported mask and sets the default connector->state->scaling_mode to
DRM_MODE_SCALE_ASPECT. When DRM_MODE_ATOMIC_RESET allocates a zeroed
state, scaling_mode becomes DRM_MODE_SCALE_NONE, which forces
crtc_state->mode_changed in intel_digital_connector_atomic_check(). On a
non-native panel mode, gmch_panel_fitting() hits
MISSING_CASE(conn_state->scaling_mode) and fails with -EINVAL, while
pch_panel_fitting() triggers two WARN_ON() splats and falls through to
DRM_MODE_SCALE_FULLSCREEN instead of preserving the aspect ratio.
[ ... ]
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index 7b97f531acbfb..e276f00f74c58 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -2505,6 +2505,20 @@ intel_sdvo_connector_duplicate_state(struct drm_connector *connector)
> return &state->base.base;
> }
>
> +static struct drm_connector_state *
> +intel_sdvo_connector_create_state(struct drm_connector *connector)
> +{
> + struct intel_sdvo_connector_state *state;
> +
> + state = kzalloc_obj(*state);
> + if (!state)
> + return ERR_PTR(-ENOMEM);
> +
> + __drm_atomic_helper_connector_state_init(&state->base.base, connector);
> +
> + return &state->base.base;
> +}
[ ... ]
> diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
> index 840e1dcdc2d0f..d40a8d2c41858 100644
> --- a/drivers/gpu/drm/i915/display/intel_tv.c
> +++ b/drivers/gpu/drm/i915/display/intel_tv.c
> @@ -902,6 +902,20 @@ intel_tv_connector_duplicate_state(struct drm_connector *connector)
> return &state->base;
> }
>
> +static struct drm_connector_state *
> +intel_tv_connector_create_state(struct drm_connector *connector)
> +{
> + struct intel_tv_connector_state *state;
> +
> + state = kzalloc_obj(*state);
> + if (!state)
> + return ERR_PTR(-ENOMEM);
> +
> + __drm_atomic_helper_connector_state_init(&state->base, connector);
> +
> + return &state->base;
> +}
[Severity: Medium]
Do intel_sdvo_connector_create_state() and
intel_tv_connector_create_state() drop the connector default TV format,
enhancement and margin values populated during connector initialization?
On SDVO TV/LVDS connectors, intel_sdvo_tv_create_property() initializes
connector->state->tv.legacy_mode to
intel_sdvo_connector->tv_format_supported[0], and
intel_sdvo_create_enhance_property_tv() and
intel_sdvo_create_enhance_property_lvds() populate the default enhancement
values queried from hardware. Leaving state->base.base.tv.legacy_mode as
0 in intel_sdvo_connector_create_state() triggers
drm_WARN_ON(connector->dev, 1) in
intel_sdvo_connector_atomic_get_property() whenever format 0 is not in
tv_format_supported[], and zeroes all hardware enhancement defaults.
Similarly, intel_tv_connector_create_state() leaves
state->base.tv.margins zeroed instead of restoring the BIOS default
margins (54, 36, 46, 37) configured in intel_tv_add_properties().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-drm-i915-conversion-state-readout-v1-0-b7132f72644d@kernel.org?part=5
next prev parent reply other threads:[~2026-11-24 11:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 10:59 [PATCH 0/6] drm/i915: Support DRM_MODE_ATOMIC_RESET Maxime Ripard
2026-11-24 10:59 ` [PATCH 1/6] drm/atomic-state-helper: Provide more STATE_CHECK_* variants Maxime Ripard
2026-11-24 10:59 ` [PATCH 2/6] drm/i915: Use the STATE_CHECK_* macros in the pipe config comparison Maxime Ripard
2026-11-24 11:23 ` Jani Nikula
2026-11-24 10:59 ` [PATCH 3/6] drm/i915: Implement CRTC atomic_create_state Maxime Ripard
2026-11-24 11:26 ` sashiko-bot
2026-11-24 10:59 ` [PATCH 4/6] drm/i915: Implement plane atomic_create_state Maxime Ripard
2026-11-24 11:19 ` sashiko-bot
2026-11-24 10:59 ` [PATCH 5/6] drm/i915: Implement connector atomic_create_state Maxime Ripard
2026-11-24 11:21 ` sashiko-bot [this message]
2026-11-24 10:59 ` [PATCH 6/6] drm/i915: Carry the current state over created states Maxime Ripard
2026-11-24 11:40 ` 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-231040@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox