[PATCH] drm/amd/display: expose additional modifier for DCN32/321

Marek Olšák maraeo at gmail.com
Tue Jun 28 12:31:58 UTC 2022


This needs to be a loop inserting all 64K_R_X and all 256K_R_X modifiers.

If num_pipes > 16, insert 256K_R_X first, else insert 64K_R_X first. Insert
the other one after that. For example:

      for (unsigned i = 0; i < 2; i++) {

         unsigned swizzle_r_x;


         /* Insert the best one first. */

         if (num_pipes > 16)

            swizzle_r_x = !i ? AMD_FMT_MOD_TILE_GFX11_256K_R_X :
AMD_FMT_MOD_TILE_GFX9_64K_R_X;

         else

            swizzle_r_x = !i ? AMD_FMT_MOD_TILE_GFX9_64K_R_X :
AMD_FMT_MOD_TILE_GFX11_256K_R_X;


         uint64_t modifier_r_x = ...

         add_modifier(,,,

         add_modifier(,,,
         add_modifier(,,,
         add_modifier(,,,
         add_modifier(,,,
      }


Marek

On Mon, Jun 27, 2022 at 10:32 AM Aurabindo Pillai <aurabindo.pillai at amd.com>
wrote:

> [Why&How]
> Some userspace expect a backwards compatible modifier on DCN32/321. For
> hardware with num_pipes more than 16, we expose the most efficient
> modifier first. As a fall back method, we need to expose slightly
> inefficient
> modifier AMD_FMT_MOD_TILE_GFX9_64K_R_X after the best option.
>
> Also set the number of packers to fixed value as required per hardware
> documentation. This value is cached during hardware initialization and
> can be read through the base driver.
>
> Fixes: 0a2c19562ffe ('Revert "drm/amd/display: ignore modifiers when
> checking for format support"')
> Signed-off-by: Aurabindo Pillai <aurabindo.pillai at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 3 +--
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++++-
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 1a512d78673a..0f5bfe5df627 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -743,8 +743,7 @@ static int convert_tiling_flags_to_modifier(struct
> amdgpu_framebuffer *afb)
>                         switch (version) {
>                         case AMD_FMT_MOD_TILE_VER_GFX11:
>                                 pipe_xor_bits = min(block_size_bits - 8,
> pipes);
> -                               packers = min(block_size_bits - 8 -
> pipe_xor_bits,
> -
>  ilog2(adev->gfx.config.gb_addr_config_fields.num_pkrs));
> +                               packers =
> ilog2(adev->gfx.config.gb_addr_config_fields.num_pkrs);
>                                 break;
>                         case AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS:
>                                 pipe_xor_bits = min(block_size_bits - 8,
> pipes);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index c9145864ed2b..bea9cee37f65 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5203,6 +5203,7 @@ add_gfx11_modifiers(struct amdgpu_device *adev,
>         int pkrs = 0;
>         u32 gb_addr_config;
>         unsigned swizzle_r_x;
> +       uint64_t modifier_r_x_best;
>         uint64_t modifier_r_x;
>         uint64_t modifier_dcc_best;
>         uint64_t modifier_dcc_4k;
> @@ -5223,10 +5224,12 @@ add_gfx11_modifiers(struct amdgpu_device *adev,
>
>         modifier_r_x = AMD_FMT_MOD |
>                 AMD_FMT_MOD_SET(TILE_VERSION, AMD_FMT_MOD_TILE_VER_GFX11) |
> -               AMD_FMT_MOD_SET(TILE, swizzle_r_x) |
>                 AMD_FMT_MOD_SET(PIPE_XOR_BITS, pipe_xor_bits) |
>                 AMD_FMT_MOD_SET(PACKERS, pkrs);
>
> +       modifier_r_x_best = modifier_r_x | AMD_FMT_MOD_SET(TILE,
> AMD_FMT_MOD_TILE_GFX11_256K_R_X);
> +       modifier_r_x = modifier_r_x | AMD_FMT_MOD_SET(TILE,
> AMD_FMT_MOD_TILE_GFX9_64K_R_X);
> +
>         /* DCC_CONSTANT_ENCODE is not set because it can't vary with gfx11
> (it's implied to be 1). */
>         modifier_dcc_best = modifier_r_x |
>                 AMD_FMT_MOD_SET(DCC, 1) |
> @@ -5247,6 +5250,9 @@ add_gfx11_modifiers(struct amdgpu_device *adev,
>         add_modifier(mods, size, capacity, modifier_dcc_best |
> AMD_FMT_MOD_SET(DCC_RETILE, 1));
>         add_modifier(mods, size, capacity, modifier_dcc_4k |
> AMD_FMT_MOD_SET(DCC_RETILE, 1));
>
> +       if (num_pipes > 16)
> +               add_modifier(mods, size, capacity, modifier_r_x_best);
> +
>         add_modifier(mods, size, capacity, modifier_r_x);
>
>         add_modifier(mods, size, capacity, AMD_FMT_MOD |
> --
> 2.36.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220628/0f919636/attachment.htm>


More information about the amd-gfx mailing list