From 5b58b838fef99d5bf096988ff6ba938cf92b6838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Tue, 1 Jul 2025 11:18:58 -0700 Subject: [PATCH] anv: move view_usage check to before setting the protected bit on it Otherwise the comparison will always be false for protected content. Also remove extra setting of the protected bit that was happening later. Fixes: 8d9cc6aa236 ("anv: properly flag image/imageviews for ISL protection") Reviewed-by: Sagar Ghuge Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_image_view.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/anv_image_view.c b/src/intel/vulkan/anv_image_view.c index a974d1c3dab..ee51bcb0d7e 100644 --- a/src/intel/vulkan/anv_image_view.c +++ b/src/intel/vulkan/anv_image_view.c @@ -58,12 +58,12 @@ 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); + /* Propagate the protection flag of the image to the view. */ + view_usage |= surface->isl.usage & ISL_SURF_USAGE_PROTECTED_BIT; + /* If this is a HiZ buffer we can sample from with a programmable clear * value (SKL+), define the clear value to the optimal constant. */ @@ -112,9 +112,6 @@ anv_image_fill_surface_state(struct anv_device *device, view_usage & ISL_SURF_USAGE_TEXTURE_BIT); state_inout->clear_address = clear_address; - if (image->vk.create_flags & VK_IMAGE_CREATE_PROTECTED_BIT) - view_usage |= ISL_SURF_USAGE_PROTECTED_BIT; - isl_surf_fill_state(&device->isl_dev, surface_state_map, .surf = isl_surf, .view = &view,