From f84ed620c26ea3d74ec792ce6c70ad628f667d40 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 10 Feb 2026 14:59:18 -0800 Subject: [PATCH] anv: set missing protected bit for protected depth/stencil surfaces This bit is set in mocs for other protected attachment types by anv_image_fill_surface_state() however was ommited for depth/stencil attachments here. Without the protected bit set, it causes heavy black artifacting when attaching a protected depth attachment image to a framebuffer. Fixes: 794b0496e94 ("anv: enable protected memory") Signed-off-by: Juston Li Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index dea7cd6abfc..aa5e11f37ac 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -5817,8 +5817,12 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) info.depth_surf = &depth_surface->isl; info.depth_address = anv_address_physical(depth_address); + + isl_surf_usage_flags_t isl_usage = ISL_SURF_USAGE_DEPTH_BIT; + if (anv_image_is_protected(image)) + isl_usage |= ISL_SURF_USAGE_PROTECTED_BIT; info.mocs = - anv_mocs(device, depth_address.bo, ISL_SURF_USAGE_DEPTH_BIT); + anv_mocs(device, depth_address.bo, isl_usage); info.hiz_usage = gfx->depth_att.aux_usage; if (info.hiz_usage != ISL_AUX_USAGE_NONE) { @@ -5855,8 +5859,12 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) info.stencil_aux_usage = image->planes[stencil_plane].aux_usage; info.stencil_address = anv_address_physical(stencil_address); + + isl_surf_usage_flags_t isl_usage = ISL_SURF_USAGE_STENCIL_BIT; + if (anv_image_is_protected(image)) + isl_usage |= ISL_SURF_USAGE_PROTECTED_BIT; info.mocs = - anv_mocs(device, stencil_address.bo, ISL_SURF_USAGE_STENCIL_BIT); + anv_mocs(device, stencil_address.bo, isl_usage); } isl_emit_depth_stencil_hiz_s(&device->isl_dev, dw, &info);