diff --git a/.pick_status.json b/.pick_status.json index 708fee142a3..eb021a15648 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -814,7 +814,7 @@ "description": "anv: add missing alignment for AUX-TT mapping", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4cdd3178fb10723e91060a75c34f379a1a92184c", "notes": null diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 3222d75ab30..b333833c31a 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -1395,7 +1395,7 @@ anv_bo_vma_alloc_or_close(struct anv_device *device, /* If we're using the AUX map, make sure we follow the required * alignment. */ - if (device->info->has_aux_map && (alloc_flags & ANV_BO_ALLOC_DEDICATED)) + if (alloc_flags & ANV_BO_ALLOC_AUX_TT_ALIGNED) align = MAX2(intel_aux_map_get_alignment(device->aux_map_ctx), align); /* Opportunistically align addresses to 2Mb when above 1Mb. We do this @@ -1608,7 +1608,6 @@ anv_device_import_bo_from_host_ptr(struct anv_device *device, assert(!(alloc_flags & (ANV_BO_ALLOC_MAPPED | ANV_BO_ALLOC_HOST_CACHED | ANV_BO_ALLOC_HOST_COHERENT | - ANV_BO_ALLOC_DEDICATED | ANV_BO_ALLOC_PROTECTED | ANV_BO_ALLOC_FIXED_ADDRESS))); assert(alloc_flags & ANV_BO_ALLOC_EXTERNAL); diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 612caa5c553..94bead94ce7 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -4010,7 +4010,6 @@ VkResult anv_AllocateMemory( case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO: dedicated_info = (void *)ext; - alloc_flags |= ANV_BO_ALLOC_DEDICATED; break; case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO: { @@ -4058,6 +4057,20 @@ VkResult anv_AllocateMemory( if (mem->vk.alloc_flags & VK_MEMORY_PROPERTY_PROTECTED_BIT) alloc_flags |= ANV_BO_ALLOC_PROTECTED; + /* For now, always allocated AUX-TT aligned memory, regardless of dedicated + * allocations. An application can for example, suballocate a large + * VkDeviceMemory and try to bind an image created with a CCS modifier. In + * that case we cannot disable CCS if the alignment doesn´t meet the AUX-TT + * requirements, so we need to ensure both the VkDeviceMemory and the + * alignment reported through vkGetImageMemoryRequirements() meet the + * AUX-TT requirement. + * + * TODO: when we enable EXT_descriptor_buffer, we'll be able to drop the + * AUX-TT alignment for that type of allocation. + */ + if (device->info->has_aux_map) + alloc_flags |= ANV_BO_ALLOC_AUX_TT_ALIGNED; + /* Anything imported or exported is EXTERNAL. Apply implicit sync to be * compatible with clients relying on implicit fencing. This matches the * behavior in iris i915_batch_submit. An example client is VA-API. diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index c719d40eae6..c90cb3ab0dc 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -406,8 +406,8 @@ enum anv_bo_alloc_flags { /** Has an address which is visible to the client */ ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS = (1 << 8), - /** This BO will be dedicated to a buffer or an image */ - ANV_BO_ALLOC_DEDICATED = (1 << 9), + /** Align the BO's virtual address to match AUX-TT requirements */ + ANV_BO_ALLOC_AUX_TT_ALIGNED = (1 << 9), /** This buffer is allocated from local memory and should be cpu visible */ ANV_BO_ALLOC_LOCAL_MEM_CPU_VISIBLE = (1 << 10), @@ -5280,14 +5280,7 @@ anv_bo_allows_aux_map(const struct anv_device *device, if (device->aux_map_ctx == NULL) return false; - /* Technically, we really only care about what offset the image is bound - * into on the BO, but we don't have that information here. As a heuristic, - * rely on the BO offset instead. - */ - if (bo->offset % intel_aux_map_get_alignment(device->aux_map_ctx) != 0) - return false; - - return true; + return (bo->alloc_flags & ANV_BO_ALLOC_AUX_TT_ALIGNED) != 0; } static inline bool