mbox series

[v2,00/11] amd/display: Add GFX9+ modifier support.

Message ID 20200904160709.123970-1-bas@basnieuwenhuizen.nl (mailing list archive)
Headers show
Series amd/display: Add GFX9+ modifier support. | expand

Message

Bas Nieuwenhuizen Sept. 4, 2020, 4:06 p.m. UTC
This adds modifier support to radeonsi.
It has been tested on

- VEGA10, RAVEN, NAVI14
- weston, sway, X with xf86-video-amdgpu (i.e. legacy path still works)

and includes some basic testing of the layout code.

The main goal is to keep it somewhat simple and regression free, so
on the display side this series only exposes what the current GPU
can render to. While we could expose more I think that is more
suitable for follow-up work as the benefit would be minimal and
there are some more design discussion there to discuss that are
orthogonal from the initial implementation.

Similarly this series only exposes 32-bpp displayable DCC in the cases
that radeonsi would use it and any extra capabilities here should be
future work.

I believe these are by far the most complicated modifiers we've seen
up till now, mostly related to

- GPU identification for cases where it matters wrt tiling.
- Every generation having tiling layout changes
- Compression settings.

I believe the complexity is necessary as every layout should be different
and all layouts should be the best in some situation (though not all
combinations of GPU parameters will actually have an existing GPU).

That said, on the render side the number of modifiers actually listed for
a given GPU is ~10, and in the current implementation that is the same
for the display side. (we could expose more actually differing layouts
on the display side for cross-GPU compatibility, but I consider that
out of scope for this initial work).

This series can be found on
https://github.com/BNieuwenhuizen/linux/tree/modifiers

An userspace implementation in radeonsi can be found on
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6176

v2:

Per suggestion from Daniel Vetter I added logic to get the tiling_flags at
addfb2 time and convert them into modifiers for GFX9+.  Furthermore, the DCC
constant econding modifers only get exposed on RAVEN2 and newer.

Bas Nieuwenhuizen (11):
  drm/amd/display: Do not silently accept DCC for multiplane formats.
  drm/amd: Init modifier field of helper fb.
  drm/amd/display: Honor the offset for plane 0.
  drm/fourcc:  Add AMD DRM modifiers.
  drm/amd/display: Store tiling_flags in the framebuffer.
  drm/amd/display: Convert tiling_flags to modifiers.
  drm/amd/display: Refactor surface tiling setup.
  drm/amd/display: Set DC options from modifiers.
  drm/amd/display: Add formats for DCC with 2/3 planes.
  drm/amd/display: Expose modifiers.
  drm/amd/display: Clean up GFX9 tiling_flags path.

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 169 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |   3 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 754 ++++++++++++++----
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 -
 include/uapi/drm/drm_fourcc.h                 | 115 +++
 6 files changed, 880 insertions(+), 165 deletions(-)

Comments

Daniel Vetter Sept. 7, 2020, 8:27 a.m. UTC | #1
On Fri, Sep 04, 2020 at 06:06:58PM +0200, Bas Nieuwenhuizen wrote:
> This adds modifier support to radeonsi.
> It has been tested on
> 
> - VEGA10, RAVEN, NAVI14
> - weston, sway, X with xf86-video-amdgpu (i.e. legacy path still works)
> 
> and includes some basic testing of the layout code.
> 
> The main goal is to keep it somewhat simple and regression free, so
> on the display side this series only exposes what the current GPU
> can render to. While we could expose more I think that is more
> suitable for follow-up work as the benefit would be minimal and
> there are some more design discussion there to discuss that are
> orthogonal from the initial implementation.
> 
> Similarly this series only exposes 32-bpp displayable DCC in the cases
> that radeonsi would use it and any extra capabilities here should be
> future work.
> 
> I believe these are by far the most complicated modifiers we've seen
> up till now, mostly related to
> 
> - GPU identification for cases where it matters wrt tiling.
> - Every generation having tiling layout changes
> - Compression settings.
> 
> I believe the complexity is necessary as every layout should be different
> and all layouts should be the best in some situation (though not all
> combinations of GPU parameters will actually have an existing GPU).
> 
> That said, on the render side the number of modifiers actually listed for
> a given GPU is ~10, and in the current implementation that is the same
> for the display side. (we could expose more actually differing layouts
> on the display side for cross-GPU compatibility, but I consider that
> out of scope for this initial work).
> 
> This series can be found on
> https://github.com/BNieuwenhuizen/linux/tree/modifiers
> 
> An userspace implementation in radeonsi can be found on
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6176
> 
> v2:
> 
> Per suggestion from Daniel Vetter I added logic to get the tiling_flags at
> addfb2 time and convert them into modifiers for GFX9+.  Furthermore, the DCC
> constant econding modifers only get exposed on RAVEN2 and newer.

I read through the patches, lgtm.
-Daniel

> 
> Bas Nieuwenhuizen (11):
>   drm/amd/display: Do not silently accept DCC for multiplane formats.
>   drm/amd: Init modifier field of helper fb.
>   drm/amd/display: Honor the offset for plane 0.
>   drm/fourcc:  Add AMD DRM modifiers.
>   drm/amd/display: Store tiling_flags in the framebuffer.
>   drm/amd/display: Convert tiling_flags to modifiers.
>   drm/amd/display: Refactor surface tiling setup.
>   drm/amd/display: Set DC options from modifiers.
>   drm/amd/display: Add formats for DCC with 2/3 planes.
>   drm/amd/display: Expose modifiers.
>   drm/amd/display: Clean up GFX9 tiling_flags path.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 169 +++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |   3 +
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 754 ++++++++++++++----
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 -
>  include/uapi/drm/drm_fourcc.h                 | 115 +++
>  6 files changed, 880 insertions(+), 165 deletions(-)
> 
> -- 
> 2.28.0
>
Ernst Sjöstrand Sept. 7, 2020, 8:51 a.m. UTC | #2
Den fre 4 sep. 2020 kl 18:07 skrev Bas Nieuwenhuizen <
bas@basnieuwenhuizen.nl>:

> This adds modifier support to radeonsi.
>

Wouldn't it be more correct to say that this adds modifier support to
amdgpu (and enables it to work with radeonsi OpenGL)
or something like that?

//E


> It has been tested on
>
> - VEGA10, RAVEN, NAVI14
> - weston, sway, X with xf86-video-amdgpu (i.e. legacy path still works)
>
> and includes some basic testing of the layout code.
>
> The main goal is to keep it somewhat simple and regression free, so
> on the display side this series only exposes what the current GPU
> can render to. While we could expose more I think that is more
> suitable for follow-up work as the benefit would be minimal and
> there are some more design discussion there to discuss that are
> orthogonal from the initial implementation.
>
> Similarly this series only exposes 32-bpp displayable DCC in the cases
> that radeonsi would use it and any extra capabilities here should be
> future work.
>
> I believe these are by far the most complicated modifiers we've seen
> up till now, mostly related to
>
> - GPU identification for cases where it matters wrt tiling.
> - Every generation having tiling layout changes
> - Compression settings.
>
> I believe the complexity is necessary as every layout should be different
> and all layouts should be the best in some situation (though not all
> combinations of GPU parameters will actually have an existing GPU).
>
> That said, on the render side the number of modifiers actually listed for
> a given GPU is ~10, and in the current implementation that is the same
> for the display side. (we could expose more actually differing layouts
> on the display side for cross-GPU compatibility, but I consider that
> out of scope for this initial work).
>
> This series can be found on
> https://github.com/BNieuwenhuizen/linux/tree/modifiers
>
> An userspace implementation in radeonsi can be found on
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6176
>
> v2:
>
> Per suggestion from Daniel Vetter I added logic to get the tiling_flags at
> addfb2 time and convert them into modifiers for GFX9+.  Furthermore, the
> DCC
> constant econding modifers only get exposed on RAVEN2 and newer.
>
> Bas Nieuwenhuizen (11):
>   drm/amd/display: Do not silently accept DCC for multiplane formats.
>   drm/amd: Init modifier field of helper fb.
>   drm/amd/display: Honor the offset for plane 0.
>   drm/fourcc:  Add AMD DRM modifiers.
>   drm/amd/display: Store tiling_flags in the framebuffer.
>   drm/amd/display: Convert tiling_flags to modifiers.
>   drm/amd/display: Refactor surface tiling setup.
>   drm/amd/display: Set DC options from modifiers.
>   drm/amd/display: Add formats for DCC with 2/3 planes.
>   drm/amd/display: Expose modifiers.
>   drm/amd/display: Clean up GFX9 tiling_flags path.
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 169 +++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |   3 +
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 754 ++++++++++++++----
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 -
>  include/uapi/drm/drm_fourcc.h                 | 115 +++
>  6 files changed, 880 insertions(+), 165 deletions(-)
>
> --
> 2.28.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
Bas Nieuwenhuizen Sept. 7, 2020, 11:11 a.m. UTC | #3
On Mon, Sep 7, 2020 at 10:51 AM Ernst Sjöstrand <ernstp@gmail.com> wrote:
>
>
>
> Den fre 4 sep. 2020 kl 18:07 skrev Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>:
>>
>> This adds modifier support to radeonsi.
>
>
> Wouldn't it be more correct to say that this adds modifier support to amdgpu (and enables it to work with radeonsi OpenGL)
> or something like that?

Yep, this was copy pasted from the userspace MR ...

>
> //E
>
>>
>> It has been tested on
>>
>> - VEGA10, RAVEN, NAVI14
>> - weston, sway, X with xf86-video-amdgpu (i.e. legacy path still works)
>>
>> and includes some basic testing of the layout code.
>>
>> The main goal is to keep it somewhat simple and regression free, so
>> on the display side this series only exposes what the current GPU
>> can render to. While we could expose more I think that is more
>> suitable for follow-up work as the benefit would be minimal and
>> there are some more design discussion there to discuss that are
>> orthogonal from the initial implementation.
>>
>> Similarly this series only exposes 32-bpp displayable DCC in the cases
>> that radeonsi would use it and any extra capabilities here should be
>> future work.
>>
>> I believe these are by far the most complicated modifiers we've seen
>> up till now, mostly related to
>>
>> - GPU identification for cases where it matters wrt tiling.
>> - Every generation having tiling layout changes
>> - Compression settings.
>>
>> I believe the complexity is necessary as every layout should be different
>> and all layouts should be the best in some situation (though not all
>> combinations of GPU parameters will actually have an existing GPU).
>>
>> That said, on the render side the number of modifiers actually listed for
>> a given GPU is ~10, and in the current implementation that is the same
>> for the display side. (we could expose more actually differing layouts
>> on the display side for cross-GPU compatibility, but I consider that
>> out of scope for this initial work).
>>
>> This series can be found on
>> https://github.com/BNieuwenhuizen/linux/tree/modifiers
>>
>> An userspace implementation in radeonsi can be found on
>> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6176
>>
>> v2:
>>
>> Per suggestion from Daniel Vetter I added logic to get the tiling_flags at
>> addfb2 time and convert them into modifiers for GFX9+.  Furthermore, the DCC
>> constant econding modifers only get exposed on RAVEN2 and newer.
>>
>> Bas Nieuwenhuizen (11):
>>   drm/amd/display: Do not silently accept DCC for multiplane formats.
>>   drm/amd: Init modifier field of helper fb.
>>   drm/amd/display: Honor the offset for plane 0.
>>   drm/fourcc:  Add AMD DRM modifiers.
>>   drm/amd/display: Store tiling_flags in the framebuffer.
>>   drm/amd/display: Convert tiling_flags to modifiers.
>>   drm/amd/display: Refactor surface tiling setup.
>>   drm/amd/display: Set DC options from modifiers.
>>   drm/amd/display: Add formats for DCC with 2/3 planes.
>>   drm/amd/display: Expose modifiers.
>>   drm/amd/display: Clean up GFX9 tiling_flags path.
>>
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 169 +++-
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |   2 +-
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |   3 +
>>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 754 ++++++++++++++----
>>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 -
>>  include/uapi/drm/drm_fourcc.h                 | 115 +++
>>  6 files changed, 880 insertions(+), 165 deletions(-)
>>
>> --
>> 2.28.0
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx