mbox series

[v6,0/8] drm: Support per-plane async flip configuration

Message ID 20240614153535.351689-1-andrealmeid@igalia.com (mailing list archive)
Headers show
Series drm: Support per-plane async flip configuration | expand

Message

André Almeida June 14, 2024, 3:35 p.m. UTC
AMD hardware can do async flips with overlay planes, but currently there's no
easy way to enable that in DRM. To solve that, this patchset creates a new
drm_plane field, bool async_flip, that allows drivers to choose which plane can
or cannot do async flips. This is latter used on drm_atomic_set_property when
users want to do async flips.

Patch 1 allows async commits with IN_FENCE_ID in any driver.

Patches 2 to 7 have no function change. As per current code, every driver that
allows async page flips using the atomic API, allows doing it only in the
primary plane. Those patches then enable it for every driver.

Patch 8 finally enables async flip on overlay planes for amdgpu.

Changes from v5:
- Instead of enabling plane->async_flip in the common code, move it to driver
code.
- Enable primary plane async flip on every driver
https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/

André Almeida (8):
  drm/atomic: Allow userspace to use explicit sync with atomic async
    flips
  drm: Support per-plane async flip configuration
  drm/amdgpu: Enable async flips on the primary plane
  drm: atmel-hlcdc: Enable async flips on the primary plane
  drm/i915: Enable async flips on the primary plane
  drm/nouveau: Enable async flips on the primary plane
  drm/vc4: Enable async flips on the primary plane
  drm/amdgpu: Make it possible to async flip overlay planes

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c         | 3 +++
 drivers/gpu/drm/drm_atomic_uapi.c                       | 8 +++++---
 drivers/gpu/drm/i915/display/i9xx_plane.c               | 3 +++
 drivers/gpu/drm/nouveau/dispnv04/crtc.c                 | 4 ++++
 drivers/gpu/drm/nouveau/dispnv50/wndw.c                 | 4 ++++
 drivers/gpu/drm/vc4/vc4_plane.c                         | 4 +++-
 include/drm/drm_plane.h                                 | 5 +++++
 8 files changed, 29 insertions(+), 4 deletions(-)

Comments

Dmitry Baryshkov June 14, 2024, 5:32 p.m. UTC | #1
On Fri, Jun 14, 2024 at 12:35:27PM GMT, André Almeida wrote:
> AMD hardware can do async flips with overlay planes, but currently there's no
> easy way to enable that in DRM. To solve that, this patchset creates a new
> drm_plane field, bool async_flip, that allows drivers to choose which plane can
> or cannot do async flips. This is latter used on drm_atomic_set_property when
> users want to do async flips.
> 
> Patch 1 allows async commits with IN_FENCE_ID in any driver.
> 
> Patches 2 to 7 have no function change. As per current code, every driver that
> allows async page flips using the atomic API, allows doing it only in the
> primary plane. Those patches then enable it for every driver.
> 
> Patch 8 finally enables async flip on overlay planes for amdgpu.
> 
> Changes from v5:
> - Instead of enabling plane->async_flip in the common code, move it to driver
> code.
> - Enable primary plane async flip on every driver
> https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
> 
> André Almeida (8):
>   drm/atomic: Allow userspace to use explicit sync with atomic async
>     flips
>   drm: Support per-plane async flip configuration
>   drm/amdgpu: Enable async flips on the primary plane
>   drm: atmel-hlcdc: Enable async flips on the primary plane
>   drm/i915: Enable async flips on the primary plane
>   drm/nouveau: Enable async flips on the primary plane
>   drm/vc4: Enable async flips on the primary plane
>   drm/amdgpu: Make it possible to async flip overlay planes
> 
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c         | 3 +++
>  drivers/gpu/drm/drm_atomic_uapi.c                       | 8 +++++---
>  drivers/gpu/drm/i915/display/i9xx_plane.c               | 3 +++
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c                 | 4 ++++
>  drivers/gpu/drm/nouveau/dispnv50/wndw.c                 | 4 ++++
>  drivers/gpu/drm/vc4/vc4_plane.c                         | 4 +++-

The main question is why only these drivers were updated.

>  include/drm/drm_plane.h                                 | 5 +++++
>  8 files changed, 29 insertions(+), 4 deletions(-)
> 
> -- 
> 2.45.2
>
André Almeida June 14, 2024, 7:37 p.m. UTC | #2
Hi Dmitry,

Em 14/06/2024 14:32, Dmitry Baryshkov escreveu:
> On Fri, Jun 14, 2024 at 12:35:27PM GMT, André Almeida wrote:
>> AMD hardware can do async flips with overlay planes, but currently there's no
>> easy way to enable that in DRM. To solve that, this patchset creates a new
>> drm_plane field, bool async_flip, that allows drivers to choose which plane can
>> or cannot do async flips. This is latter used on drm_atomic_set_property when
>> users want to do async flips.
>>
>> Patch 1 allows async commits with IN_FENCE_ID in any driver.
>>
>> Patches 2 to 7 have no function change. As per current code, every driver that
>> allows async page flips using the atomic API, allows doing it only in the
>> primary plane. Those patches then enable it for every driver.
>>
>> Patch 8 finally enables async flip on overlay planes for amdgpu.
>>
>> Changes from v5:
>> - Instead of enabling plane->async_flip in the common code, move it to driver
>> code.
>> - Enable primary plane async flip on every driver
>> https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
>>
>> André Almeida (8):
>>    drm/atomic: Allow userspace to use explicit sync with atomic async
>>      flips
>>    drm: Support per-plane async flip configuration
>>    drm/amdgpu: Enable async flips on the primary plane
>>    drm: atmel-hlcdc: Enable async flips on the primary plane
>>    drm/i915: Enable async flips on the primary plane
>>    drm/nouveau: Enable async flips on the primary plane
>>    drm/vc4: Enable async flips on the primary plane
>>    drm/amdgpu: Make it possible to async flip overlay planes
>>
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
>>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c         | 3 +++
>>   drivers/gpu/drm/drm_atomic_uapi.c                       | 8 +++++---
>>   drivers/gpu/drm/i915/display/i9xx_plane.c               | 3 +++
>>   drivers/gpu/drm/nouveau/dispnv04/crtc.c                 | 4 ++++
>>   drivers/gpu/drm/nouveau/dispnv50/wndw.c                 | 4 ++++
>>   drivers/gpu/drm/vc4/vc4_plane.c                         | 4 +++-
> 
> The main question is why only these drivers were updated.
> 

According to `git grep async_page_flip`, only those drivers supports 
async page flip. The only corner case is radeon, that does supports 
async but doesn't support planes.

Do you know any other driver that should be updated to?

>>   include/drm/drm_plane.h                                 | 5 +++++
>>   8 files changed, 29 insertions(+), 4 deletions(-)
>>
>> -- 
>> 2.45.2
>>
>
Ville Syrjälä June 19, 2024, 11:57 a.m. UTC | #3
On Fri, Jun 14, 2024 at 04:37:41PM -0300, André Almeida wrote:
> Hi Dmitry,
> 
> Em 14/06/2024 14:32, Dmitry Baryshkov escreveu:
> > On Fri, Jun 14, 2024 at 12:35:27PM GMT, André Almeida wrote:
> >> AMD hardware can do async flips with overlay planes, but currently there's no
> >> easy way to enable that in DRM. To solve that, this patchset creates a new
> >> drm_plane field, bool async_flip, that allows drivers to choose which plane can
> >> or cannot do async flips. This is latter used on drm_atomic_set_property when
> >> users want to do async flips.
> >>
> >> Patch 1 allows async commits with IN_FENCE_ID in any driver.
> >>
> >> Patches 2 to 7 have no function change. As per current code, every driver that
> >> allows async page flips using the atomic API, allows doing it only in the
> >> primary plane. Those patches then enable it for every driver.
> >>
> >> Patch 8 finally enables async flip on overlay planes for amdgpu.
> >>
> >> Changes from v5:
> >> - Instead of enabling plane->async_flip in the common code, move it to driver
> >> code.
> >> - Enable primary plane async flip on every driver
> >> https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
> >>
> >> André Almeida (8):
> >>    drm/atomic: Allow userspace to use explicit sync with atomic async
> >>      flips
> >>    drm: Support per-plane async flip configuration
> >>    drm/amdgpu: Enable async flips on the primary plane
> >>    drm: atmel-hlcdc: Enable async flips on the primary plane
> >>    drm/i915: Enable async flips on the primary plane
> >>    drm/nouveau: Enable async flips on the primary plane
> >>    drm/vc4: Enable async flips on the primary plane
> >>    drm/amdgpu: Make it possible to async flip overlay planes
> >>
> >>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
> >>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c         | 3 +++
> >>   drivers/gpu/drm/drm_atomic_uapi.c                       | 8 +++++---
> >>   drivers/gpu/drm/i915/display/i9xx_plane.c               | 3 +++
> >>   drivers/gpu/drm/nouveau/dispnv04/crtc.c                 | 4 ++++
> >>   drivers/gpu/drm/nouveau/dispnv50/wndw.c                 | 4 ++++
> >>   drivers/gpu/drm/vc4/vc4_plane.c                         | 4 +++-
> > 
> > The main question is why only these drivers were updated.
> > 
> 
> According to `git grep async_page_flip`, only those drivers supports 
> async page flip. The only corner case is radeon, that does supports 
> async but doesn't support planes.

The primary plane will alwyas exist (drm_crtc_init() will create
one for the old drivers that don't do it explicitly). So you
should be able to convert radeon as well. And looks like some
pre-dc amdgpu stuff is in a similar situation.

That should presumably allow the old flag to be removed entirely?
Hmm, I suppose drm_getcap() would need a bit of work to eg. go
through all the planes to see if any of them support async flips.

> 
> Do you know any other driver that should be updated to?
> 
> >>   include/drm/drm_plane.h                                 | 5 +++++
> >>   8 files changed, 29 insertions(+), 4 deletions(-)
> >>
> >> -- 
> >> 2.45.2
> >>
> >