Re: [PATCH 01/82] drm/amd/display: Fall back to overlay cursor on dcn4x when top plane doesn't fill CRTC

Timur Kristóf <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
On 2026. augusztus 19., szerda 9:27:20 közép-európai nyári idő Michel Dänzer 
wrote:
> [ Adding Timur ]

Thank you for your consideration!

> 
> On 8/18/26 22:14, [email protected] wrote:
> > From: James Lin <[email protected]>
> > 
> > [why]
> > amdgpu_dm_crtc_get_cursor_mode() returns DM_CURSOR_NATIVE_MODE early and
> > unconditionally for dcn4.x. That early return was added because these
> > ASICs no longer have the cursor-on-scaled-plane or cursor-on-yuv-plane
> > restrictions of older DCN, so native cursor is fine in those cases.
> > However, it also bypasses the "does the top plane fill the CRTC?" (hole)
> > evaluation further down. When the top/primary plane does not cover the
> > whole CRTC, the cursor must fall back to an overlay plane so it is
> > composited over the uncovered region; keeping the native cursor there
> > produces an incorrect result. As a consequence
> > igt@amdgpu/amd_cursor_overlay@non-full, which verifies exactly this
> > native->overlay fallback, fails on dcn42.
> > 
> > [how]
> > Change unconditional early return with a skip_fmt_scale_restrictions flag.
> > For dcn4.x keep skipping the YUV / active-color-pipeline / different-scale
> > overlay triggers (genuinely unnecessary on this hardware), but fall
> > through to the existing entire_crtc_covered check so a top plane that does
> > not fill the CRTC still selects DM_CURSOR_OVERLAY_MODE. Native mode is
> > still chosen when the plane covers the whole CRTC.
> > 
> > Update the amdgpu_dm_cursor KUnit tests accordingly: exercise the dcn4x
> > path with a full atomic state fixture (full coverage -> native) and add a
> > dcn4x hole case (top plane does not fill the CRTC -> overlay).
> > 
> > Reviewed-by: Tom Chung <[email protected]>
> > Signed-off-by: James Lin <[email protected]>
> > Signed-off-by: Ivan Lipski <[email protected]>
> > ---
> > 
> >  .../amd/display/amdgpu_dm/amdgpu_dm_cursor.c  | 28 ++++++++--------
> >  .../amdgpu_dm/tests/amdgpu_dm_cursor_test.c   | 32 +++++++++++++------
> >  2 files changed, 38 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.c
> > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.c index
> > 9534848ed240c..c41fce07b8fa8 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.c
> > [...]
> > @@ -300,15 +297,17 @@ int amdgpu_dm_crtc_get_cursor_mode(struct
> > amdgpu_device *adev,> 
> >  	 */
> >  	
> >  	if (amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 0, 1) ||
> >  	
> >  	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 0) ||
> > 
> > -#if defined(CONFIG_DRM_AMD_DC_DCN6_0)
> > 
> >  	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 1) ||
> >  	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(6, 0, 0) ||
> > 
> > -#else
> > -	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 1) ||
> > -#endif
> > 
> >  	    !dm_crtc_state->base.enable) {
> > 
> > -		*cursor_mode = DM_CURSOR_NATIVE_MODE;
> > -		return 0;
> > +		/*
> > +		 * Newer DCN has no cursor-on-scaled/yuv-plane 
restriction, so
> > +		 * skip those overlay triggers below. A plane that does 
not fill
> > +		 * the CRTC still needs overlay mode so the cursor 
renders over
> > +		 * the hole, so fall through to the coverage check 
instead of
> > +		 * unconditionally forcing native mode here.
> > +		 */
> > +		skip_fmt_scale_restrictions = true;
> > 
> >  	}
> 
> Timur, looks like this might break your fix in cea54c52d82d
> ("drm/amd/display: Set native cursor mode for disabled CRTCs") again.
> 
> Maybe the CRTC disabled case should be handled separately from the DCE cases
> after all.

I think the cleanest solution may be to just move this check:
!dm_crtc_state->base.enable
into a separate if statement above this one.

What do you think, would that fix it?

Thanks,
Timur
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.