diff mbox series

[v12,2/2] drm/amdgpu: Enable async flip on overlay planes

Message ID 20250127-tonyk-async_flip-v12-2-0f7f8a8610d3@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/atomic: Ease async flip restrictions | expand

Commit Message

André Almeida Jan. 27, 2025, 7:59 p.m. UTC
amdgpu can handle async flips on overlay planes, so allow it for atomic
async checks.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Xaver Hugl Jan. 29, 2025, 2:36 p.m. UTC | #1
Am Mo., 27. Jan. 2025 um 21:00 Uhr schrieb André Almeida
<andrealmeid@igalia.com>:
>
> amdgpu can handle async flips on overlay planes, so allow it for atomic
> async checks.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 774cc3f4f3fd9a964fe48c66eb596d2f6dfee602..6bfed3d1530e6610eea025b477f409ee505870da 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -1258,21 +1258,23 @@ static int amdgpu_dm_plane_atomic_check(struct drm_plane *plane,
>  }
>
>  static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
> -                                             struct drm_atomic_state *state)
> +                                             struct drm_atomic_state *state, bool flip)
>  {
>         struct drm_crtc_state *new_crtc_state;
>         struct drm_plane_state *new_plane_state;
>         struct dm_crtc_state *dm_new_crtc_state;
>
> -       /* Only support async updates on cursor planes. */
> -       if (plane->type != DRM_PLANE_TYPE_CURSOR)
> +       if (flip) {
> +               if (plane->type != DRM_PLANE_TYPE_OVERLAY)
> +                       return -EINVAL;
> +       } else if (plane->type != DRM_PLANE_TYPE_CURSOR)
>                 return -EINVAL;

This changes the logic for cursor updates, flipping on the cursor
plane allowed async updates before. Is that intentional?

>         new_plane_state = drm_atomic_get_new_plane_state(state, plane);
>         new_crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_state->crtc);
>         dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
>         /* Reject overlay cursors for now*/
> -       if (dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
> +       if (!flip && dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
>                 return -EINVAL;
>
>         return 0;
>
> --
> 2.48.0
>
André Almeida Jan. 29, 2025, 3:53 p.m. UTC | #2
Em 29/01/2025 11:36, Xaver Hugl escreveu:
> Am Mo., 27. Jan. 2025 um 21:00 Uhr schrieb André Almeida
> <andrealmeid@igalia.com>:
>>
>> amdgpu can handle async flips on overlay planes, so allow it for atomic
>> async checks.
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 ++++++----
>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
>> index 774cc3f4f3fd9a964fe48c66eb596d2f6dfee602..6bfed3d1530e6610eea025b477f409ee505870da 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
>> @@ -1258,21 +1258,23 @@ static int amdgpu_dm_plane_atomic_check(struct drm_plane *plane,
>>   }
>>
>>   static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
>> -                                             struct drm_atomic_state *state)
>> +                                             struct drm_atomic_state *state, bool flip)
>>   {
>>          struct drm_crtc_state *new_crtc_state;
>>          struct drm_plane_state *new_plane_state;
>>          struct dm_crtc_state *dm_new_crtc_state;
>>
>> -       /* Only support async updates on cursor planes. */
>> -       if (plane->type != DRM_PLANE_TYPE_CURSOR)
>> +       if (flip) {
>> +               if (plane->type != DRM_PLANE_TYPE_OVERLAY)
>> +                       return -EINVAL;
>> +       } else if (plane->type != DRM_PLANE_TYPE_CURSOR)
>>                  return -EINVAL;
> 
> This changes the logic for cursor updates, flipping on the cursor
> plane allowed async updates before. Is that intentional?
> 

It's not the intention of this patch to disable async updates on cursor 
planes... but I don't think it's happening here? Async plane updates and 
async page flips are different things.

Any function that used to call amdgpu_dm_plane_atomic_async_check() for 
an async update on a cursor plane will continue to being able to do that.

For callers of _atomic_async_check() from a page flip path (like 
drm_atomic_set_property()), those couldn't flip a cursor plane, and will 
continue to be like that for now.

At least this is my analysis, please let me know if I got something wrong.
Xaver Hugl Jan. 29, 2025, 5:23 p.m. UTC | #3
> It's not the intention of this patch to disable async updates on cursor
> planes... but I don't think it's happening here? Async plane updates and
> async page flips are different things.
Right, these are different code paths. Nevermind then, it's just a bit
confusing.

> Any function that used to call amdgpu_dm_plane_atomic_async_check() for
> an async update on a cursor plane will continue to being able to do that.
>
> For callers of _atomic_async_check() from a page flip path (like
> drm_atomic_set_property()), those couldn't flip a cursor plane, and will
> continue to be like that for now.
>
> At least this is my analysis, please let me know if I got something wrong.
Harry Wentland Feb. 6, 2025, 10:22 p.m. UTC | #4
On 2025-01-27 14:59, André Almeida wrote:
> amdgpu can handle async flips on overlay planes, so allow it for atomic
> async checks.
> 
> Signed-off-by: André Almeida <andrealmeid@igalia.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 774cc3f4f3fd9a964fe48c66eb596d2f6dfee602..6bfed3d1530e6610eea025b477f409ee505870da 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -1258,21 +1258,23 @@ static int amdgpu_dm_plane_atomic_check(struct drm_plane *plane,
>  }
>  
>  static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
> -					      struct drm_atomic_state *state)
> +					      struct drm_atomic_state *state, bool flip)
>  {
>  	struct drm_crtc_state *new_crtc_state;
>  	struct drm_plane_state *new_plane_state;
>  	struct dm_crtc_state *dm_new_crtc_state;
>  
> -	/* Only support async updates on cursor planes. */
> -	if (plane->type != DRM_PLANE_TYPE_CURSOR)
> +	if (flip) {
> +		if (plane->type != DRM_PLANE_TYPE_OVERLAY)
> +			return -EINVAL;
> +	} else if (plane->type != DRM_PLANE_TYPE_CURSOR)
>  		return -EINVAL;
>  
>  	new_plane_state = drm_atomic_get_new_plane_state(state, plane);
>  	new_crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_state->crtc);
>  	dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
>  	/* Reject overlay cursors for now*/
> -	if (dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
> +	if (!flip && dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
>  		return -EINVAL;
>  
>  	return 0;
>
Alex Deucher Feb. 12, 2025, 2:54 p.m. UTC | #5
Acked-by: Alex Deucher <alexander.deucher@amd.com> for the series.

On Thu, Feb 6, 2025 at 5:37 PM Harry Wentland <harry.wentland@amd.com> wrote:
>
>
>
> On 2025-01-27 14:59, André Almeida wrote:
> > amdgpu can handle async flips on overlay planes, so allow it for atomic
> > async checks.
> >
> > Signed-off-by: André Almeida <andrealmeid@igalia.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> > index 774cc3f4f3fd9a964fe48c66eb596d2f6dfee602..6bfed3d1530e6610eea025b477f409ee505870da 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> > @@ -1258,21 +1258,23 @@ static int amdgpu_dm_plane_atomic_check(struct drm_plane *plane,
> >  }
> >
> >  static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
> > -                                           struct drm_atomic_state *state)
> > +                                           struct drm_atomic_state *state, bool flip)
> >  {
> >       struct drm_crtc_state *new_crtc_state;
> >       struct drm_plane_state *new_plane_state;
> >       struct dm_crtc_state *dm_new_crtc_state;
> >
> > -     /* Only support async updates on cursor planes. */
> > -     if (plane->type != DRM_PLANE_TYPE_CURSOR)
> > +     if (flip) {
> > +             if (plane->type != DRM_PLANE_TYPE_OVERLAY)
> > +                     return -EINVAL;
> > +     } else if (plane->type != DRM_PLANE_TYPE_CURSOR)
> >               return -EINVAL;
> >
> >       new_plane_state = drm_atomic_get_new_plane_state(state, plane);
> >       new_crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_state->crtc);
> >       dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
> >       /* Reject overlay cursors for now*/
> > -     if (dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
> > +     if (!flip && dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
> >               return -EINVAL;
> >
> >       return 0;
> >
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
index 774cc3f4f3fd9a964fe48c66eb596d2f6dfee602..6bfed3d1530e6610eea025b477f409ee505870da 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
@@ -1258,21 +1258,23 @@  static int amdgpu_dm_plane_atomic_check(struct drm_plane *plane,
 }
 
 static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
-					      struct drm_atomic_state *state)
+					      struct drm_atomic_state *state, bool flip)
 {
 	struct drm_crtc_state *new_crtc_state;
 	struct drm_plane_state *new_plane_state;
 	struct dm_crtc_state *dm_new_crtc_state;
 
-	/* Only support async updates on cursor planes. */
-	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+	if (flip) {
+		if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+			return -EINVAL;
+	} else if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		return -EINVAL;
 
 	new_plane_state = drm_atomic_get_new_plane_state(state, plane);
 	new_crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_state->crtc);
 	dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
 	/* Reject overlay cursors for now*/
-	if (dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
+	if (!flip && dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE)
 		return -EINVAL;
 
 	return 0;