Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/12] drm/i915: Complete no-op "async flips" by hand
Date: Mon, 16 Nov 2026 13:10:40 +0200	[thread overview]
Message-ID: <avrksFHUYSQTfE95@intel.com> (raw)
In-Reply-To: <sashiko-outbox-216616@kernel.org>

On Mon, Nov 16, 2026 at 09:28:56AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [Medium] drm/i915: unreachable noop check in
>   intel_crtc_complete_noop_async_flip()
> - [Medium] drm/i915: intel_crtc_complete_noop_async_flip() checks
>   cleared uapi.event
> --
> 
> commit 828bac38a449130d5473b2a45f7f646152241cec
> Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm/i915: Complete no-op "async flips" by hand
> 
> This commit adds helpers to manually send the vblank event for atomic
> async flip commits when no planes are updated.
> 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index f79caeb5a82ec..dd12929284bb8 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -1190,6 +1190,42 @@ static void intel_crtc_disable_flip_done(struct intel_atomic_state *state,
> >  	}
> >  }
> >  
> > +static void intel_crtc_complete_noop_async_flip(struct intel_crtc_state *crtc_state)
> > +{
> > +	struct intel_display *display = to_intel_display(crtc_state);
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > +
> > +	if (!crtc_state->do_async_flip)
> > +		return;
> > +
> > +	/*
> > +	 * If there are planes actually performing the async flip then
> > +	 * the commit will be completed via the flip done interrupt
> > +	 * handler. For a fully no-op "async flip" the commit must
> > +	 * be completed by hand as no interrupt will be raised.
> > +	 */
> > +	if (crtc_state->update_planes)
> > +		return;
> 
> [Severity: Medium]
> Can crtc_state->do_async_flip ever be true when crtc_state->update_planes
> is zero?
> 
> intel_crtc_duplicate_state() initializes both fields to zero/false, and the
> only place that sets new_crtc_state->do_async_flip = true is
> intel_plane_atomic_check_with_state() -> intel_plane_atomic_calc_changes()
> for a visible plane, after intel_plane_atomic_check_with_state() has
> already set BIT(plane->id) in new_crtc_state->update_planes:
> 
> drivers/gpu/drm/i915/display/intel_plane.c:intel_plane_atomic_check_with_state() {
> 	...
> 	if (new_plane_state->uapi.visible || old_plane_state->uapi.visible)
> 		new_crtc_state->update_planes |= BIT(plane->id);
> 	...
> 	return intel_plane_atomic_calc_changes(old_crtc_state, new_crtc_state,
> 					       old_plane_state, new_plane_state);
> }
> 
> When no visible planes are in the atomic state, crtc_state->do_async_flip
> remains false (unlike crtc_state->uapi.async_flip), so this function always
> returns early on the first check and never completes a no-op async flip.
> 
> > +
> > +	if (crtc_state->uapi.event) {
> > +		spin_lock_irq(&display->drm->event_lock);
> > +		drm_crtc_send_vblank_event(&crtc->base,
> > +					   crtc_state->uapi.event);
> > +		spin_unlock_irq(&display->drm->event_lock);
> > +
> > +		crtc_state->uapi.event = NULL;
> > +	}
> > +}
> 
> [Severity: Medium]
> Will crtc_state->uapi.event always be NULL by the time
> intel_crtc_complete_noop_async_flip() runs?
> 
> In intel_atomic_commit_tail(), commit_modeset_enables() runs before
> intel_atomic_complete_noop_async_flips().  When new_crtc_state->do_async_flip
> is true, intel_update_crtc() -> intel_pipe_update_start() calls
> intel_crtc_prepare_vblank_event(new_crtc_state, &crtc->flip_done_event),
> which moves new_crtc_state->uapi.event into crtc->flip_done_event and sets
> new_crtc_state->uapi.event = NULL.  With update_planes == 0, no flip-done
> interrupt will fire to consume crtc->flip_done_event, leaving the event
> unsent and causing drm_atomic_helper_wait_for_flip_done() to time out.

Ack. Need to deal with that and not prepare the flip done
event without a plane to send it.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-11-16 11:11 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ä [this message]
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
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=avrksFHUYSQTfE95@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --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 \
    /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