The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [RFC] drm/msm/dpu: set possible_crtcs on cursor planes
  2026-11-18 20:47 [RFC] drm/msm/dpu: set possible_crtcs on cursor planes Erik Tagirov
@ 2026-11-18 20:22 ` Dmitry Baryshkov
  2026-11-18 21:24   ` Erik Tagirov
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Baryshkov @ 2026-11-18 20:22 UTC (permalink / raw)
  To: Erik Tagirov
  Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
	marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
	freedreno, linux-kernel

On Wed, Nov 18, 2026 at 09:47:42PM +0100, Erik Tagirov wrote:
> I am using a lesser known wayland compositor that uses the possible_crtcs field of a plane to detect
> which one to use for the cursor. On the Lenovo T14s two cursor planes are created, each with possible_crtcs set
> to 0xff. Which from my understanding means that they can be used with any crtc.
> 
> However, the compositor picks the wrong cursor plane which results in a lag of ~17ms
> on each DRM_IOCTL_MODE_SETPLANE call. Making the cursor movements sluggish.
> 
> After some investigation, I found out that this is due to the legacy_cursor_update flag not being set
> in drm_atomic_helper_update_plane() which has an impact in msm_atomic_commit_tail() where the fallback branch
> is taken.
> 
> The lag is solved with the patch below.
> 
> Best regards
> - Erik Tagirov
> 
> The cursor plane must be used with the correct crtc to ensure an
> asynchronous commit
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index da3556eb6ecc..4e0e9c2d8062 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -877,6 +877,9 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
>  			ret = PTR_ERR(crtc);
>  			return ret;
>  		}
> +		/* Ensure that cursor planes are commited asynchronously */
> +		if (cursor_planes[i])
> +			cursor_planes[i]->possible_crtcs = drm_crtc_mask(crtc);

Here you are setting that the plane can only be used on a particular
CRTC. This is not true for these planes (even being cursor, it still can
be used on all the CRTCs).

>  	}
>  
>  	/* All CRTCs are compatible with all encoders */
> -- 
> 2.49.0
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RFC] drm/msm/dpu: set possible_crtcs on cursor planes
@ 2026-11-18 20:47 Erik Tagirov
  2026-11-18 20:22 ` Dmitry Baryshkov
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Tagirov @ 2026-11-18 20:47 UTC (permalink / raw)
  To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
	marijn.suijten, airlied, simona
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel

I am using a lesser known wayland compositor that uses the possible_crtcs field of a plane to detect
which one to use for the cursor. On the Lenovo T14s two cursor planes are created, each with possible_crtcs set
to 0xff. Which from my understanding means that they can be used with any crtc.

However, the compositor picks the wrong cursor plane which results in a lag of ~17ms
on each DRM_IOCTL_MODE_SETPLANE call. Making the cursor movements sluggish.

After some investigation, I found out that this is due to the legacy_cursor_update flag not being set
in drm_atomic_helper_update_plane() which has an impact in msm_atomic_commit_tail() where the fallback branch
is taken.

The lag is solved with the patch below.

Best regards
- Erik Tagirov

The cursor plane must be used with the correct crtc to ensure an
asynchronous commit
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index da3556eb6ecc..4e0e9c2d8062 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -877,6 +877,9 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
 			ret = PTR_ERR(crtc);
 			return ret;
 		}
+		/* Ensure that cursor planes are commited asynchronously */
+		if (cursor_planes[i])
+			cursor_planes[i]->possible_crtcs = drm_crtc_mask(crtc);
 	}
 
 	/* All CRTCs are compatible with all encoders */
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] drm/msm/dpu: set possible_crtcs on cursor planes
  2026-11-18 20:22 ` Dmitry Baryshkov
@ 2026-11-18 21:24   ` Erik Tagirov
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Tagirov @ 2026-11-18 21:24 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
	marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
	freedreno, linux-kernel

On Wed, Nov 18, 2026 at 10:22:48PM +0200, Dmitry Baryshkov wrote:
> On Wed, Nov 18, 2026 at 09:47:42PM +0100, Erik Tagirov wrote:
> > I am using a lesser known wayland compositor that uses the possible_crtcs field of a plane to detect
> > which one to use for the cursor. On the Lenovo T14s two cursor planes are created, each with possible_crtcs set
> > to 0xff. Which from my understanding means that they can be used with any crtc.
> > 
> > However, the compositor picks the wrong cursor plane which results in a lag of ~17ms
> > on each DRM_IOCTL_MODE_SETPLANE call. Making the cursor movements sluggish.
> > 
> > After some investigation, I found out that this is due to the legacy_cursor_update flag not being set
> > in drm_atomic_helper_update_plane() which has an impact in msm_atomic_commit_tail() where the fallback branch
> > is taken.
> > 
> > The lag is solved with the patch below.
> > 
> > Best regards
> > - Erik Tagirov
> > 
> > The cursor plane must be used with the correct crtc to ensure an
> > asynchronous commit
> > ---
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > index da3556eb6ecc..4e0e9c2d8062 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > @@ -877,6 +877,9 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
> >  			ret = PTR_ERR(crtc);
> >  			return ret;
> >  		}
> > +		/* Ensure that cursor planes are commited asynchronously */
> > +		if (cursor_planes[i])
> > +			cursor_planes[i]->possible_crtcs = drm_crtc_mask(crtc);
> 
> Here you are setting that the plane can only be used on a particular
> CRTC. This is not true for these planes (even being cursor, it still can
> be used on all the CRTCs).
> 
Thank you for the quick reply, I understand that the hardware supports
universal planes, so this is not a good solution.

I will see how I can solve this from userspace instead, need to look
more closely at the DRM API maybe there is another way to determine what
plane belongs to what CRTC.
The current implementation does not work, because the possible_crtcs is set to 0xff
and the compositor picks the cursor plane that comes first in the list which is used by crtc109 
instead of one used by crtc108. This why the legacy_cursor_update flag is not set in
drm_atomic_helper_update_plane()

BR
- Erik
> >  	}
> >  
> >  	/* All CRTCs are compatible with all encoders */
> > -- 
> > 2.49.0
> > 
> 
> -- 
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-18 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 20:47 [RFC] drm/msm/dpu: set possible_crtcs on cursor planes Erik Tagirov
2026-11-18 20:22 ` Dmitry Baryshkov
2026-11-18 21:24   ` Erik Tagirov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox