From 8d9cc6aa236fe2986858f272afe581fb08a72ee3 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 1 Jul 2024 14:09:49 +0300 Subject: [PATCH] anv: properly flag image/imageviews for ISL protection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Cc: mesa-stable Reviewed-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_image.c | 3 +++ src/intel/vulkan/anv_image_view.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index f53608d6a78..f8035c1e76a 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -252,6 +252,9 @@ anv_image_choose_isl_surf_usage(struct anv_physical_device *device, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT)) isl_usage |= ISL_SURF_USAGE_2D_3D_COMPATIBLE_BIT; + if (vk_create_flags & VK_IMAGE_CREATE_PROTECTED_BIT) + isl_usage |= ISL_SURF_USAGE_PROTECTED_BIT; + /* Even if we're only using it for transfer operations, clears to depth and * stencil images happen as depth and stencil so they need the right ISL * usage bits or else things will fall apart. diff --git a/src/intel/vulkan/anv_image_view.c b/src/intel/vulkan/anv_image_view.c index a18d70b78d4..6d019e6ec6d 100644 --- a/src/intel/vulkan/anv_image_view.c +++ b/src/intel/vulkan/anv_image_view.c @@ -58,6 +58,9 @@ anv_image_fill_surface_state(struct anv_device *device, struct isl_view view = *view_in; view.usage |= view_usage; + /* Propagate the protection flag of the image to the view. */ + view_usage |= surface->isl.usage & ISL_SURF_USAGE_PROTECTED_BIT; + if (view_usage == ISL_SURF_USAGE_RENDER_TARGET_BIT) view.swizzle = anv_swizzle_for_render(view.swizzle);