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: 8d9cc6aa23 ("anv: properly flag image/imageviews for ISL protection")
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35870>
This commit is contained in:
Iván Briano
2025-07-01 11:18:58 -07:00
committed by Marge Bot
parent 5f31e6b286
commit 5b58b838fe
+3 -6
View File
@@ -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,