From 7838aa25bc33d83317a9ea0dd5242ae863666d1e Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Wed, 22 Nov 2023 16:31:10 +0200 Subject: [PATCH] anv: remove heuristic preferring dedicated allocations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This heuristic doesn't show much difference when you have a beafy processor but on lower end skus, it increase the number of buffers in the execbuffer ioctl, adding significant overhead in i915. Signed-off-by: Lionel Landwerlin Fixes: 4cdd3178fb ("anv: Meet CCS alignment reqs with dedicated allocs") Tested-by: Dmitry Osipenko Reviewed-by: José Roberto de Souza Part-of: (cherry picked from commit b18006397be4bfaa78a444166ae0e60b2756bf6a) --- .pick_status.json | 2 +- src/intel/vulkan/anv_image.c | 27 ++++++--------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 46e7bd4..0e5dc68 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1734,7 +1734,7 @@ "description": "anv: remove heuristic preferring dedicated allocations", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4cdd3178fb10723e91060a75c34f379a1a92184c", "notes": null diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 77a2d73..8e14b46 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1919,32 +1919,17 @@ anv_image_get_memory_requirements(struct anv_device *device, switch (ext->sType) { case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: { VkMemoryDedicatedRequirements *requirements = (void *)ext; - if (image->vk.wsi_legacy_scanout || image->from_ahb) { - /* If we need to set the tiling for external consumers, we need a - * dedicated allocation. + if (image->vk.wsi_legacy_scanout || + image->from_ahb || + (isl_drm_modifier_has_aux(image->vk.drm_format_mod) && + anv_image_uses_aux_map(device, image))) { + /* If we need to set the tiling for external consumers or the + * modifier involves AUX tables, we need a dedicated allocation. * * See also anv_AllocateMemory. */ requirements->prefersDedicatedAllocation = true; requirements->requiresDedicatedAllocation = true; - } else if (anv_image_uses_aux_map(device, image)) { - /* We request a dedicated allocation to guarantee that the BO will - * be aux-map compatible (see anv_bo_vma_alloc_or_close and - * anv_bo_allows_aux_map). - * - * TODO: This is an untested heuristic. It's not known if this - * guarantee is worth losing suballocation. - * - * If we don't have an aux-map compatible BO at the time we bind - * this image to device memory, we'll change the aux usage. - * - * It may be possible to handle an image using a modifier in the - * same way. However, we choose to keep things simple and require - * a dedicated allocation for that case. - */ - requirements->prefersDedicatedAllocation = true; - requirements->requiresDedicatedAllocation = - isl_drm_modifier_has_aux(image->vk.drm_format_mod); } else { requirements->prefersDedicatedAllocation = false; requirements->requiresDedicatedAllocation = false; -- 2.7.4