Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
To: Nemesa Garg <nemesa.garg@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status
Date: Thu, 27 Aug 2026 15:15:41 +0530	[thread overview]
Message-ID: <cf81a473-c630-4c7c-af91-849ab58deaf0@intel.com> (raw)
In-Reply-To: <20260821044755.2234490-2-nemesa.garg@intel.com>



On 8/21/2026 10:17 AM, Nemesa Garg wrote:
> In joiner mode, secondary cursor commits may still be running
> even when the primary cursor commit is done. Walking the secondary
> pipes also requires holding the secondary planes modeset locks.
> Add intel_cursor_lock_joined_planes() to acquire modeset locks
> for all secondary cursor planes. Check all joined cursor commit
> status before taking the fast path. If any commit is still pending,
> fallback to slow path.
> 
> v2: Use intel_crtc_joined_pipe_mask(). [Ville]
> v3: Lock secondary cursor CRTCs and planes. [sashiko]
> v4: Iterate the full joined mask uniformly in both helpers, no
>      primary special-case.
>      Move the parameter-change check above the lock acquisition so
>      we don't grab secondary locks just to fall to slow path. [Chaitanya]
> v5: Remove extra header declerartion. [Chaitanya]

declaration.

Other than that, LGTM

Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>

P.S. Please add version prefix while sending out the patches.

> 
> Assisted-by: Claude:claude-sonnet-4.6
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_cursor.c | 68 ++++++++++++++++++---
>   1 file changed, 59 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
> index 0673f16f6fd0..bc1e58d5c4c5 100644
> --- a/drivers/gpu/drm/i915/display/intel_cursor.c
> +++ b/drivers/gpu/drm/i915/display/intel_cursor.c
> @@ -796,6 +796,50 @@ void intel_cursor_unpin_work(struct kthread_work *base)
>   	intel_plane_destroy_state(&plane->base, &plane_state->uapi);
>   }
>   
> +static int intel_cursor_lock_joined_planes(struct intel_display *display,
> +					   const struct intel_crtc_state *crtc_state,
> +					   struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct intel_crtc *pipe_crtc;
> +	int ret;
> +
> +	for_each_intel_crtc_in_pipe_mask(display, pipe_crtc,
> +					 intel_crtc_joined_pipe_mask(crtc_state)) {
> +		struct intel_plane *pipe_plane =
> +			intel_crtc_get_plane(pipe_crtc, PLANE_CURSOR);
> +
> +		ret = drm_modeset_lock(&pipe_crtc->base.mutex, ctx);
> +		if (ret)
> +			return ret;
> +
> +		ret = drm_modeset_lock(&pipe_plane->base.mutex, ctx);
> +		if (ret)
> +			return ret;
> +	}
> +	return 0;
> +}
> +
> +static bool
> +intel_cursor_joiner_commits_idle(struct intel_display *display,
> +				 const struct intel_crtc_state *crtc_state)
> +{
> +	struct intel_crtc *pipe_crtc;
> +
> +	for_each_intel_crtc_in_pipe_mask(display, pipe_crtc,
> +					 intel_crtc_joined_pipe_mask(crtc_state)) {
> +		struct intel_plane *pipe_plane =
> +			intel_crtc_get_plane(pipe_crtc, PLANE_CURSOR);
> +		struct intel_plane_state *pipe_plane_state =
> +			to_intel_plane_state(pipe_plane->base.state);
> +
> +		if (pipe_plane_state->uapi.commit &&
> +		    !try_wait_for_completion(&pipe_plane_state->uapi.commit->hw_done))
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>   static int
>   intel_legacy_cursor_update(struct drm_plane *_plane,
>   			   struct drm_crtc *_crtc,
> @@ -833,15 +877,6 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
>   	    crtc_state->joiner_pipes)
>   		goto slow;
>   
> -	/*
> -	 * Don't do an async update if there is an outstanding commit modifying
> -	 * the plane.  This prevents our async update's changes from getting
> -	 * overridden by a previous synchronous update's state.
> -	 */
> -	if (old_plane_state->uapi.commit &&
> -	    !try_wait_for_completion(&old_plane_state->uapi.commit->hw_done))
> -		goto slow;
> -
>   	/*
>   	 * If any parameters change that may affect watermarks,
>   	 * take the slowpath. Only changing fb or position should be
> @@ -855,6 +890,21 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
>   	    !old_plane_state->uapi.fb != !fb)
>   		goto slow;
>   
> +	ret = intel_cursor_lock_joined_planes(display, crtc_state, ctx);
> +	if (ret == -EDEADLK)
> +		return ret;
> +	if (ret)
> +		goto slow;
> +
> +	/*
> +	 * Don't do an async update if there is an outstanding commit modifying
> +	 * any of the joined cursor planes. This prevents our async update's
> +	 * changes from getting overridden by a previous synchronous update's
> +	 * state.
> +	 */
> +	if (!intel_cursor_joiner_commits_idle(display, crtc_state))
> +		goto slow;
> +
>   	new_plane_state = to_intel_plane_state(intel_plane_duplicate_state(&plane->base));
>   	if (!new_plane_state)
>   		return -ENOMEM;


  reply	other threads:[~2026-08-27  9:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  4:47 [PATCH 0/6] Enable joiner cursor fast updates Nemesa Garg
2026-08-21  4:47 ` [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status Nemesa Garg
2026-08-27  9:45   ` Borah, Chaitanya Kumar [this message]
2026-08-21  4:47 ` [PATCH 2/6] drm/i915/cursor: Add helper to update cursor plane Nemesa Garg
2026-08-27  9:45   ` Borah, Chaitanya Kumar
2026-08-21  4:47 ` [PATCH 3/6] drm/i915/cursor: Handle secondary cursor state Nemesa Garg
2026-08-27  9:45   ` Borah, Chaitanya Kumar
2026-08-21  4:47 ` [PATCH 4/6] drm/i915/cursor: Program secondary cursor planes Nemesa Garg
2026-08-27  9:46   ` Borah, Chaitanya Kumar
2026-08-21  4:47 ` [PATCH 5/6] drm/i915/cursor: Schedule cursor unpin per joined pipe Nemesa Garg
2026-08-27  9:46   ` Borah, Chaitanya Kumar
2026-08-21  4:47 ` [PATCH 6/6] drm/i915/cursor: Allow joiner cursor fast path update Nemesa Garg
2026-08-27  9:46   ` Borah, Chaitanya Kumar
2026-08-21  5:49 ` ✓ i915.CI.BAT: success for Enable joiner cursor fast updates (rev6) Patchwork
2026-08-21  9:05 ` ✗ i915.CI.Full: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2026-08-18  8:42 [PATCH 0/6] Enable joiner cursor fast updates Nemesa Garg
2026-08-18  8:42 ` [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status Nemesa Garg
2026-08-18  8:59   ` sashiko-bot
2026-07-06 11:56 [PATCH 0/6] Enable joiner cursor fast updates Nemesa Garg
2026-07-06 11:56 ` [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status Nemesa Garg
2026-07-29 15:28   ` Borah, Chaitanya Kumar
2026-06-08  6:26 [PATCH 0/6] Enable joiner cursor fast updates Nemesa Garg
2026-06-08  6:26 ` [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status Nemesa Garg
2026-07-01 16:25   ` Borah, Chaitanya Kumar
2026-07-06  8:40     ` Garg, Nemesa
2026-04-28 14:16 [PATCH 0/6] Enable joiner cursor fast updates Nemesa Garg
2026-04-28 14:16 ` [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status Nemesa Garg
2026-04-22  7:37 [PATCH 0/6] Enable joiner cursor fast updates Nemesa Garg
2026-04-22  7:37 ` [PATCH 1/6] drm/i915/cursor: Check joiner cursor commit status Nemesa Garg
2026-04-22  9:46   ` Ville Syrjälä
2026-04-27  6:14     ` Garg, Nemesa

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=cf81a473-c630-4c7c-af91-849ab58deaf0@intel.com \
    --to=chaitanya.kumar.borah@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=nemesa.garg@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