From 63db31fdfc4fe85d3357d8d34cf461333c32b970 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sun, 24 May 2020 14:23:24 +0200 Subject: [PATCH] amd/common: Add total alignment calculation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/common/ac_surface.c | 5 +++++ src/amd/common/ac_surface.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 8203a7f0426..cbbd86093e7 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -1871,22 +1871,26 @@ int ac_compute_surface(ADDR_HANDLE addrlib, const struct radeon_info *info, /* Determine the memory layout of multiple allocations in one buffer. */ surf->total_size = surf->surf_size; + surf->alignment = surf->surf_alignment; if (surf->htile_size) { surf->htile_offset = align64(surf->total_size, surf->htile_alignment); surf->total_size = surf->htile_offset + surf->htile_size; + surf->alignment = MAX2(surf->alignment, surf->htile_alignment); } if (surf->fmask_size) { assert(config->info.samples >= 2); surf->fmask_offset = align64(surf->total_size, surf->fmask_alignment); surf->total_size = surf->fmask_offset + surf->fmask_size; + surf->alignment = MAX2(surf->alignment, surf->fmask_alignment); } /* Single-sample CMASK is in a separate buffer. */ if (surf->cmask_size && config->info.samples >= 2) { surf->cmask_offset = align64(surf->total_size, surf->cmask_alignment); surf->total_size = surf->cmask_offset + surf->cmask_size; + surf->alignment = MAX2(surf->alignment, surf->cmask_alignment); } if (surf->dcc_size && @@ -1918,6 +1922,7 @@ int ac_compute_surface(ADDR_HANDLE addrlib, const struct radeon_info *info, surf->dcc_offset = align64(surf->total_size, surf->dcc_alignment); surf->total_size = surf->dcc_offset + surf->dcc_size; + surf->alignment = MAX2(surf->alignment, surf->dcc_alignment); } return 0; diff --git a/src/amd/common/ac_surface.h b/src/amd/common/ac_surface.h index 161a54c9888..22858206e46 100644 --- a/src/amd/common/ac_surface.h +++ b/src/amd/common/ac_surface.h @@ -247,6 +247,7 @@ struct radeon_surf { uint64_t display_dcc_offset; uint64_t dcc_retile_map_offset; uint64_t total_size; + uint32_t alignment; union { /* Return values for GFX8 and older. -- 2.30.2