Mesa (main): anv: Don't allocate VMA for CCS on XeHP

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 27 23:12:28 UTC 2022


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

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Fri Dec 31 16:32:50 2021 -0500

anv: Don't allocate VMA for CCS on XeHP

On XeHP, CCS doesn't require VMA on XeHP. The HW provides anything
allocated in LMEM a mapping to a CCS memory range for free. So, we:

1) use the implicit CCS framework to avoid adding an image memory
   binding for the CCS surface.
2) leave each BO sized as-is instead of adding on space for the CCS.
   Thankfully the framework only adds on space if an aux-map is present.
   XeHP has no aux-map, so this patch doesn't explicitly do anything for
   this.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14431>

---

 src/intel/vulkan/anv_allocator.c | 3 ++-
 src/intel/vulkan/anv_device.c    | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 599ba3911b9..a7060e347ce 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1716,7 +1716,8 @@ anv_device_alloc_bo(struct anv_device *device,
       .is_external = (alloc_flags & ANV_BO_ALLOC_EXTERNAL),
       .has_client_visible_address =
          (alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) != 0,
-      .has_implicit_ccs = ccs_size > 0,
+      .has_implicit_ccs = ccs_size > 0 || (device->info.verx10 >= 125 &&
+         (alloc_flags & ANV_BO_ALLOC_LOCAL_MEM)),
    };
 
    if (alloc_flags & ANV_BO_ALLOC_MAPPED) {
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 8a6958e11cc..5190f473179 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -937,7 +937,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
     */
    device->has_bindless_samplers = device->info.ver >= 8;
 
-   device->has_implicit_ccs = device->info.has_aux_map;
+   device->has_implicit_ccs = device->info.has_aux_map ||
+                              device->info.verx10 >= 125;
 
    /* Check if we can read the GPU timestamp register from the CPU */
    uint64_t u64_ignore;
@@ -3614,7 +3615,7 @@ VkResult anv_AllocateMemory(
    }
 
    /* By default, we want all VkDeviceMemory objects to support CCS */
-   if (device->physical->has_implicit_ccs)
+   if (device->physical->has_implicit_ccs && device->info.has_aux_map)
       alloc_flags |= ANV_BO_ALLOC_IMPLICIT_CCS;
 
    if (vk_flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR)



More information about the mesa-commit mailing list