[Mesa-dev] [PATCH] radv: set cb base tile swizzles for MRT speedups (v2)

Marek Olšák maraeo at gmail.com
Wed Jul 12 15:10:50 UTC 2017


On Mon, Jul 10, 2017 at 4:20 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This patch uses addrlib to workout the tile swizzles according
> to the surface index. It seems to produce the same values as
> amdgpu-pro for the deferred test.
>
> v2: don't apply swizzle to CMASK. the eg docs don't mention
> it, and we clearly don't align cmask for that.
>
> This gets the deferred demo from 730->950fps on my rx480.
> (dcc cmask elim predication patches get it further)
> I'm also seeing some improvements in Mad Max at 4K
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/amd/common/ac_surface.c   | 14 ++++++++++++++
>  src/amd/common/ac_surface.h   |  2 ++
>  src/amd/vulkan/radv_device.c  |  7 ++++++-
>  src/amd/vulkan/radv_image.c   | 12 +++++++++++-
>  src/amd/vulkan/radv_private.h |  2 ++
>  5 files changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
> index 23fb66b..0aebacc 100644
> --- a/src/amd/common/ac_surface.c
> +++ b/src/amd/common/ac_surface.c
> @@ -692,6 +692,20 @@ static int gfx6_compute_surface(ADDR_HANDLE addrlib,
>                 surf->htile_size *= 2;
>
>         surf->is_linear = surf->u.legacy.level[0].mode == RADEON_SURF_MODE_LINEAR_ALIGNED;
> +
> +       /* workout base swizzle */
> +       if (!(surf->flags & RADEON_SURF_Z_OR_SBUFFER)) {
> +               ADDR_COMPUTE_BASE_SWIZZLE_INPUT AddrBaseSwizzleIn = {0};
> +               ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT AddrBaseSwizzleOut = {0};
> +
> +               AddrBaseSwizzleIn.surfIndex = config->info.surf_index;
> +               AddrBaseSwizzleIn.tileIndex = AddrSurfInfoIn.tileIndex;
> +               AddrBaseSwizzleIn.macroModeIndex = AddrSurfInfoOut.macroModeIndex;
> +               AddrBaseSwizzleIn.pTileInfo = AddrSurfInfoOut.pTileInfo;
> +               AddrBaseSwizzleIn.tileMode = AddrSurfInfoOut.tileMode;
> +               AddrComputeBaseSwizzle(addrlib, &AddrBaseSwizzleIn, &AddrBaseSwizzleOut);
> +               surf->u.legacy.combined_swizzle = AddrBaseSwizzleOut.tileSwizzle;
> +       }
>         return 0;
>  }
>
> diff --git a/src/amd/common/ac_surface.h b/src/amd/common/ac_surface.h
> index 4d893ff..7901b86 100644
> --- a/src/amd/common/ac_surface.h
> +++ b/src/amd/common/ac_surface.h
> @@ -97,6 +97,7 @@ struct legacy_surf_layout {
>      unsigned                    depth_adjusted:1;
>      unsigned                    stencil_adjusted:1;
>
> +    uint8_t                     combined_swizzle;

"tile_swizzle" please.

The rest looks good.

Marek


More information about the mesa-dev mailing list