mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 10:08:08 +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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38480>
This commit is contained in:
parent
775f8ec105
commit
401b2066b0
2 changed files with 15 additions and 3 deletions
|
|
@ -1551,9 +1551,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.
|
||||
|
|
|
|||
|
|
@ -2969,6 +2969,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