Commit 63db31fd authored by Bas Nieuwenhuizen's avatar Bas Nieuwenhuizen Committed by Marge Bot

amd/common: Add total alignment calculation.

Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset's avatarSamuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <!5194>
parent f70b5776
......@@ -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;
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment