Module: Mesa
Branch: staging/23.3
Commit: 7838aa25bc33d83317a9ea0dd5242ae863666d1e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7838aa25bc33d83317a9ea0dd5242ae863666d1e

Author: Lionel Landwerlin <lionel.g.landwer...@intel.com>
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 <lionel.g.landwer...@intel.com>
Fixes: 4cdd3178fb ("anv: Meet CCS alignment reqs with dedicated allocs")
Tested-by: Dmitry Osipenko <dmitry.osipe...@collabora.com>
Reviewed-by: José Roberto de Souza <jose.so...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26335>
(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 46e7bd4ef9c..0e5dc68ac6f 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 77a2d733e72..8e14b46a676 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;

Reply via email to