From: Bas Nieuwenhuizen Date: Sun, 24 May 2020 12:23:24 +0000 (+0200) Subject: amd/common: Add total alignment calculation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63db31fdfc4fe85d3357d8d34cf461333c32b970;p=mesa.git amd/common: Add total alignment calculation. Reviewed-by: Marek Olšák Reviewed-by: Samuel Pitoiset Part-of: --- 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.