From fc814fa828e410b842408684066c8f8a48aefb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Fri, 9 Jan 2026 10:48:45 +0200 Subject: [PATCH] anv: skip compressed flag for bo if not supported by modifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has not been problem before the compression hint given to kernel but now that we set it we hit problems when allocating bo if modifier does not support compression. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14625 Fixes: f91de588181 ("anv: Add support to DRM_XE_GEM_CREATE_FLAG_NO_COMPRESSION") Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Reviewed-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_device.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 6fc1170a3f3..628af9c3a9b 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1579,19 +1579,18 @@ VkResult anv_AllocateMemory( NULL; mem->dedicated_image = image; + /* If there is a dedicated image with a modifier, use that to determine + * compression, otherwise use the memory type. + */ if (device->info->ver >= 20 && image && - image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT && - isl_drm_modifier_has_aux(image->vk.drm_format_mod)) { - /* ISL should skip compression modifiers when no_ccs is set. */ - assert(!INTEL_DEBUG(DEBUG_NO_CCS)); - /* Images created with the Xe2 modifiers should be allocated into - * compressed memory, but we won't get such info from the memory type, - * refer to anv_image_is_pat_compressible(). We have to check the - * modifiers and enable compression if we can here. - */ - alloc_flags |= ANV_BO_ALLOC_COMPRESSED; - } else if (mem_type->compressed && !INTEL_DEBUG(DEBUG_NO_CCS)) { - alloc_flags |= ANV_BO_ALLOC_COMPRESSED; + image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { + const bool needs_compression = + isl_drm_modifier_has_aux(image->vk.drm_format_mod); + assert(!needs_compression || !INTEL_DEBUG(DEBUG_NO_CCS)); + alloc_flags |= needs_compression ? ANV_BO_ALLOC_COMPRESSED : 0; + } else { + alloc_flags |= (mem_type->compressed && !INTEL_DEBUG(DEBUG_NO_CCS)) ? + ANV_BO_ALLOC_COMPRESSED : 0; } /* Anything imported or exported is EXTERNAL */