From cbd43cd9f8f612d394c07b07cd04a24bcbc6ad8d Mon Sep 17 00:00:00 2001 From: Jianxun Zhang Date: Mon, 14 Jul 2025 14:02:11 -0700 Subject: [PATCH] anv: No compression on host memory allocation (xe2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Xe kernel driver doesn't allow vm_bind on compressed bo if it has user pointer. And we probably shouldn't enable CCS compression on memory in any case. This change is necessary to prevent failures once we adjust the priority of compression PAT entries in a following commit: Vulkan CTS: dEQP-VK.api.buffer_marker.compute.external_host_mem.top_of_pipe. memory_dep.buffer_copy dEQP-VK.memory.external_memory_host.simple_allocation. minImportedHostPointerAlignment_x3 anv_kmd_backend.c:308: xe_vm_bind_op: Assertion `errno_ != EINVAL' failed. Signed-off-by: Jianxun Zhang Reviewed-by: José Roberto de Souza Part-of: (cherry picked from commit c7665869571d456f9259c0ab45655b6879921c7a) --- .pick_status.json | 2 +- src/intel/vulkan/anv_allocator.c | 1 + src/intel/vulkan/anv_device.c | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 44216e92a1d..3ee4dd1762b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -23594,7 +23594,7 @@ "description": "anv: No compression on host memory allocation (xe2)", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index b50cc2fe407..ce7987160bd 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -1886,6 +1886,7 @@ anv_device_import_bo_from_host_ptr(struct anv_device *device, ANV_BO_ALLOC_HOST_COHERENT | ANV_BO_ALLOC_AUX_CCS | ANV_BO_ALLOC_PROTECTED | + ANV_BO_ALLOC_COMPRESSED | 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 dc636587d98..4c336a63373 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1811,8 +1811,10 @@ VkResult anv_GetMemoryHostPointerPropertiesEXT( switch (handleType) { case VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT: - /* Host memory can be imported as any memory type. */ + pMemoryHostPointerProperties->memoryTypeBits = + device->info->ver >= 20 ? + device->physical->memory.default_buffer_mem_types : (1ull << device->physical->memory.type_count) - 1; return VK_SUCCESS;