From: sashiko-bot@kernel.org
To: "Ville Syrjala" <ville.syrjala@linux.intel.com>,
dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 11/12] drm/atomic/uapi: Make async flips a bit more palatable through atomic
Date: Mon, 16 Nov 2026 09:44:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-216633@kernel.org> (raw)
In-Reply-To: <20261116091130.13950-12-ville.syrjala@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/atomic: skipping all no-op planes breaks CRTC-only async
flips
- [Medium] drm/atomic: stale FB_DAMAGE_CLIPS read in
drm_atomic_set_property()
--
commit 64d10f48b65296ed20fc62e81d5d8b357f0e8b51
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
drm/atomic/uapi: Make async flips a bit more palatable through atomic
This commit filters out no-op property changes during atomic async flips
in drm_atomic_set_property() before duplicating plane and connector states,
while still adding the associated CRTCs to the commit.
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 7517950d2e515..87181aba14514 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
[ ... ]
> @@ -1285,16 +1326,19 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
> struct drm_plane_state *plane_state;
> struct drm_mode_config *config = &plane->dev->mode_config;
> const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private;
> -
> - plane_state = drm_atomic_get_plane_state(state, plane);
> - if (IS_ERR(plane_state)) {
> - ret = PTR_ERR(plane_state);
> - break;
> - }
> + bool is_noop = false;
>
> if (async_flip) {
> - /* no-op changes are always allowed */
> - ret = drm_atomic_plane_get_property(plane, plane_state,
> + const struct drm_plane_state *current_plane_state;
> +
> + current_plane_state =
> + __drm_atomic_get_current_plane_state(state, plane);
> + if (IS_ERR(current_plane_state)) {
> + ret = PTR_ERR(current_plane_state);
> + break;
> + }
> +
> + ret = drm_atomic_plane_get_property(plane, current_plane_state,
> prop, &old_val);
[Severity: Medium]
Does reading prop_fb_damage_clips from current_plane_state return the
previous commit's damage blob ID instead of 0?
Unlike IN_FENCE_FD (which always reports -1), drm_atomic_plane_get_property()
returns state->fb_damage_clips->base.id, and state->fb_damage_clips is only
cleared to NULL when __drm_atomic_helper_plane_duplicate_state() duplicates
the state for a new commit. Before this change, drm_atomic_get_plane_state()
ran first, so old_val was always 0 on a fresh plane state.
When current_plane_state is the un-duplicated plane->state from a previous
commit that attached damage clips, passing FB_DAMAGE_CLIPS = 0 on a
non-primary plane (such as a cursor plane) looks like a property change
(old_val != 0) and fails the async flip with -EINVAL. Conversely, if
userspace passes the same blob ID as the previous commit before FB_ID in the
property list, FB_DAMAGE_CLIPS is skipped as a no-op and then wiped to NULL
when FB_ID duplicates the plane state.
> if (ret)
> break;
> @@ -1318,25 +1362,40 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
> break;
> }
>
> - /*
> - * FIXME this is in the wrong place. Whether to do a
> - * bypass commit for async flips would is a driver
> - * decision. Drivers that want this need to just do
> - * these checks themselves somewhere.
> - */
> - if (old_val != prop_value && plane->type != DRM_PLANE_TYPE_PRIMARY) {
> - /* ask the driver if this non-primary plane is supported */
> - if (plane_funcs && plane_funcs->atomic_bypass_check)
> - ret = plane_funcs->atomic_bypass_check(plane, state, true);
> - else
> - ret = -EINVAL;
> -
> - if (ret) {
> - drm_dbg_atomic(prop->dev,
> - "[PLANE:%d:%s] does not support async flips\n",
> - obj->id, plane->name);
> - break;
> - }
> + if (old_val == prop_value)
> + is_noop = true;
> + }
> +
> + /* No-op plane property changes can be fully skipped */
> + if (is_noop) {
> + ret = 0;
> + break;
> + }
[Severity: High]
What happens when all plane property updates in an async flip commit are
no-ops (for example, primary plane FB_ID set to the current FB_ID)?
__drm_atomic_get_current_plane_state() adds the CRTC to the commit and
set_async_flip() sets crtc_state->async_flip = true, but skipping all planes
leaves the commit with zero planes in state.
On i915/xe, crtc_state->do_async_flip is only set in
intel_plane_atomic_calc_changes(), which only runs for planes in state.
With no planes in state, do_async_flip stays false:
1. If the first async flip on a pipe is a no-op, uapi.async_flip becomes
true in crtc->state without switching the primary plane to minimal
wm0/DDB. On the next async flip where FB_ID actually changes,
intel_plane_do_async_flip() sees old_crtc_state->uapi.async_flip == true
and sets do_async_flip = true, while skl_compute_wm() tries to switch to
minimal wm0/DDB for the first time; skl_ddb_add_affected_planes() and
skl_wm_add_affected_planes() then reject that and all subsequent async
flips with -EINVAL because watermarks/DDB cannot change during an async
flip.
2. intel_crtc_complete_noop_async_flip() from commit "drm/i915: Complete
no-op async flips by hand" returns early on !crtc_state->do_async_flip,
so a no-op async flip falls through to a vblank-waited sync commit.
3. On amdgpu_dm, a commit with no planes skips pageflip event arming in
amdgpu_dm_commit_planes() and falls back to drm_send_event_locked() in
amdgpu_dm_atomic_commit_tail(), sending DRM_EVENT_FLIP_COMPLETE with a
zeroed sequence and timestamp.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116091130.13950-1-ville.syrjala@linux.intel.com?part=11
next prev parent reply other threads:[~2026-11-16 9:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 9:11 [PATCH 00/12] drm/atomic: Try to make atomic+async usable, and clear up the "async update" helper confusion Ville Syrjala
2026-11-16 9:11 ` [PATCH 01/12] drm/atomic: Remove tall tales about tearing vs. "async updates" Ville Syrjala
2026-11-16 9:11 ` [PATCH 02/12] drm/atomic: s/async/bypass/ Ville Syrjala
2026-11-16 9:23 ` sashiko-bot
2026-11-16 9:11 ` [PATCH 03/12] drm/atomic: Add FIXMEs around the incorrect use of the .atomic_bypass_check() for async flips Ville Syrjala
2026-11-16 9:11 ` [PATCH 04/12] drm/atomic: Highlight that bypass commits need care Ville Syrjala
2026-11-16 9:11 ` [PATCH 05/12] drm/atomic/uapi: Eliminate the confusing drm_atomic_check_prop_changes() Ville Syrjala
2026-11-16 9:11 ` [PATCH 06/12] drm/atomic/uapi: Improve the async flip property rejection debugs Ville Syrjala
2026-11-16 9:11 ` [PATCH 07/12] drm/atomic/uapi: Document the non-obvious fence/fb_id prop behaviour Ville Syrjala
2026-11-16 9:11 ` [PATCH 08/12] drm/atomic/uapi: Add a FIXME about colorop vs. async flips Ville Syrjala
2026-11-16 9:11 ` [PATCH 09/12] drm/atomic-helper: Mark drm_atomic_crtc_state_for_each_plane_state() unsafe Ville Syrjala
2026-11-16 9:11 ` [PATCH 10/12] drm/i915: Complete no-op "async flips" by hand Ville Syrjala
2026-11-16 9:28 ` sashiko-bot
2026-11-16 11:10 ` Ville Syrjälä
2026-11-16 9:11 ` [PATCH 11/12] drm/atomic/uapi: Make async flips a bit more palatable through atomic Ville Syrjala
2026-11-16 9:44 ` sashiko-bot [this message]
2026-11-16 11:06 ` Ville Syrjälä
2026-11-16 9:11 ` [PATCH 12/12] drm/atomic/uapi: Extract {connector, crtc, plane}_async_flip_check() Ville Syrjala
2026-11-16 10:37 ` ✗ CI.checkpatch: warning for drm/atomic: Try to make atomic+async usable, and clear up the "async update" helper confusion Patchwork
2026-11-16 10:39 ` ✓ CI.KUnit: success " Patchwork
2026-11-16 11:14 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 15:21 ` ✗ Xe.CI.FULL: failure " Patchwork
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-216633@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ville.syrjala@linux.intel.com \
/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