mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
anv: ensure slab allocated memory matches image requirements
The VMA of VkDeviceMemory has to accomodate all the resources that can be bound to it. For sparse images it's 64KiB alignment, for other tiled images it's 4KiB. But we also have a workaround that requires a 64KiB alignment for Tile4 images. The initial version of the slab allocator missed the 4KiB alignment. This fix adds the workaround handling too. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes:dabb012423("anv: Implement anv_slab_bo and enable memory pool") Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> (cherry picked from commit401b2066b0) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38803>
This commit is contained in:
parent
db8281fdbb
commit
e4d77530b4
3 changed files with 16 additions and 4 deletions
|
|
@ -1064,7 +1064,7 @@
|
|||
"description": "anv: ensure slab allocated memory matches image requirements",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "dabb012423dc27e2b03f13f7144406edacc89069",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1552,9 +1552,18 @@ anv_bo_vma_calc_alignment_requirement(struct anv_device *device,
|
|||
const bool is_small_heap = anv_bo_is_small_heap(alloc_flags);
|
||||
uint32_t align = 64; /* A cache line */
|
||||
|
||||
/* If it's big enough to store a tiled resource, we need 64K alignment */
|
||||
if (size >= 64 * 1024 && !is_small_heap)
|
||||
align = MAX2(64 * 1024, align);
|
||||
/* If it's big enough to store a 64K tiled resource, we need 64K alignment.
|
||||
* Wa_22015614752 requires that some images be aligned to 64k when used on
|
||||
* multiple engines, so allocation that might contain 4k tiled images need
|
||||
* to be aligned to 64k.
|
||||
*/
|
||||
const uint64_t image_alignment =
|
||||
(size >= 64 * 1024 ||
|
||||
(device->queue_count > 1 &&
|
||||
intel_needs_workaround(device->info, 22015614752))) ?
|
||||
64 * 1024 : 4 * 1024;
|
||||
if (size >= 4 * 1024 && !is_small_heap)
|
||||
align = MAX2(image_alignment, align);
|
||||
|
||||
/* If we're using the AUX map, make sure we follow the required
|
||||
* alignment.
|
||||
|
|
|
|||
|
|
@ -2926,6 +2926,9 @@ anv_image_bind_address(struct anv_device *device,
|
|||
enum anv_image_memory_binding binding,
|
||||
struct anv_address address)
|
||||
{
|
||||
assert(anv_address_physical(address) %
|
||||
image->bindings[binding].memory_range.alignment == 0);
|
||||
|
||||
image->bindings[binding].address = address;
|
||||
|
||||
/* Map bindings for images with host transfer usage, so that we don't have
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue