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 6/6] drm/i915: Carry the current state over created states
Date: Tue, 24 Nov 2026 11:40:45 +0000 [thread overview]
Message-ID: <sashiko-outbox-231059@kernel.org> (raw)
In-Reply-To: <20261124-drm-i915-conversion-state-readout-v1-6-b7132f72644d@kernel.org>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/i915: intel_atomic_carry_over_state() skips enabled
DPMS-off CRTCs
- [High] drm/i915: uninitialized max_requested_bpc and scaling_mode on
created states
- [Medium] drm/i915: missing NV12 link carry-over in
intel_atomic_carry_over_state()
--
commit 1fe4500ef10219b7da036ae0e043737aa33211ff
Author: Maxime Ripard <mripard@kernel.org>
drm/i915: Carry the current state over created states
This commit adds intel_atomic_carry_over_state() to copy the current CRTC
hardware state and plane scaler assignment into newly created states during
DRM_MODE_ATOMIC_RESET commits.
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 1172e48daf235..d645203104a77 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -6519,6 +6519,116 @@ static int intel_atomic_check_config_and_link(struct intel_atomic_state *state)
>
> return ret;
> }
[ ... ]
> +static int intel_atomic_carry_over_state(struct intel_atomic_state *state)
> +{
> + struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> + struct intel_plane_state *old_plane_state, *new_plane_state;
> + struct intel_crtc *crtc;
> + struct intel_plane *plane;
> + int i;
> +
> + for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> + new_crtc_state) {
> + struct intel_crtc_state *carried_state;
> +
> + if (new_crtc_state->cpu_transcoder != INVALID_TRANSCODER ||
> + !old_crtc_state->hw.active)
> + continue;
[Severity: High]
Does checking !old_crtc_state->hw.active skip CRTCs that are enabled with
DPMS off (old_crtc_state->hw.enable == true, hw.active == false)?
In i915, pipe configuration, cpu_transcoder, DPLL reservations, DP tunnel
bandwidth, joiner pipes, and plane scalers are all allocated and tracked
whenever crtc_state->hw.enable is true, even while hw.active is false.
When a DRM_MODE_ATOMIC_RESET commit hits an enabled but inactive CRTC,
skipping the carry-over drops intel_dpll and icl_port_dplls without
releasing them (leaking the shared DPLL reservation in
dpll_state->pipe_mask and triggering a WARN in intel_dpll_crtc_get() on
later modesets), loses dp_tunnel_ref and joiner_pipes, and leaves
new_crtc_state->scaler_state empty while the plane loop below still copies
old_plane_state->scaler_id >= 0 into new_plane_state->scaler_id, allowing
intel_atomic_setup_scaler() to assign the same hardware scaler ID twice.
On G4X/VLV/CHV, intel_crtc_prepare_cleared_state() also preserves
crtc_state->wm even on disabled CRTCs.
[ ... ]
> + for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
> + new_plane_state, i) {
> + if (new_plane_state->scaler_id < 0 &&
> + old_plane_state->scaler_id >= 0)
> + new_plane_state->scaler_id =
> + old_plane_state->scaler_id;
> + }
[Severity: Medium]
Should this plane loop also carry over old_plane_state->planar_linked_plane
and old_plane_state->is_y_plane?
On DISPLAY_VER >= 11, scanning out a planar YUV framebuffer links the
visible UV plane to an internal Y plane whose uapi.crtc is NULL, so the Y
plane is not in crtc->state->plane_mask. When a DRM_MODE_ATOMIC_RESET
commit does not initially include the internal Y plane (for example, from
a DRM lease covering only the primary/UV plane) or switches the UV plane
to a non-planar format, intel_joiner_affected_planes() and
unlink_nv12_plane() rely on new_plane_state->planar_linked_plane and
is_y_plane to pull in and unlink the Y plane:
drivers/gpu/drm/i915/display/intel_plane.c:unlink_nv12_plane() {
if (!plane_state->planar_linked_plane)
return;
plane_state->planar_linked_plane = NULL;
if (!plane_state->is_y_plane)
return;
...
crtc_state->enabled_planes &= ~BIT(plane->id);
crtc_state->active_planes &= ~BIT(plane->id);
}
Because created plane states have planar_linked_plane == NULL and
is_y_plane == false, BIT(y_plane->id) remains set in
new_crtc_state->enabled_planes and active_planes, leaving the Y plane
programmed in hardware or causing icl_check_nv12_planes() to run out of
free Y planes and fail with -EINVAL.
> +
> + return 0;
> +}
[Severity: High]
Does intel_atomic_carry_over_state() also need to restore connector state
defaults such as max_requested_bpc, max_bpc, and scaling_mode on created
connector states?
At init time, drm_connector_attach_max_bpc_property() initializes
state->max_requested_bpc and state->max_bpc to the connector maximum, and
intel_attach_scaling_mode_property() sets state->scaling_mode to
DRM_MODE_SCALE_ASPECT. During DRM_MODE_ATOMIC_RESET,
intel_digital_connector_create_state() zero-allocates the connector state
and calls __drm_atomic_helper_connector_state_init(), leaving
max_requested_bpc, max_bpc, and scaling_mode at 0 whenever userspace does
not explicitly set those properties in the reset commit.
As a result, drm_atomic_helper_check_modeset() and
intel_digital_connector_atomic_check() see max_requested_bpc and
scaling_mode change from their previous values and force a modeset on
active CRTCs instead of taking the nomodeset path, and the modeset then
hits MISSING_CASE(0) WARNs and returns -EINVAL in
compute_sink_pipe_bpp() -> bpc_to_bpp() and gmch_panel_fitting().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-drm-i915-conversion-state-readout-v1-0-b7132f72644d@kernel.org?part=6
next prev parent reply other threads:[~2026-11-24 11:40 UTC|newest]
Thread overview: 14+ 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 13:18 ` Maxime Ripard
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
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 [this message]
2026-11-24 13:29 ` Ville Syrjälä
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-231059@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