Module: Mesa
Branch: main
Commit: b18006397be4bfaa78a444166ae0e60b2756bf6a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b18006397be4bfaa78a444166ae0e60b2756bf6a

Author: Lionel Landwerlin <[email protected]>
Date:   Wed Nov 22 16:31:10 2023 +0200

anv: remove heuristic preferring dedicated allocations

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 <[email protected]>
Fixes: 4cdd3178fb ("anv: Meet CCS alignment reqs with dedicated allocs")
Tested-by: Dmitry Osipenko <[email protected]>
Reviewed-by: José Roberto de Souza <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26335>

---

 src/intel/vulkan/anv_image.c | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index e17e54aa088..2b74e94505e 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -1928,32 +1928,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;

Reply via email to