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: 794b0496e9 ("anv: enable protected memory")
Signed-off-by: Juston Li <justonli@google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit f84ed620c2)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39969>
This commit is contained in:
Juston Li 2026-02-10 14:59:18 -08:00 committed by Dylan Baker
parent 19acd105c8
commit 3cc3c5a577
2 changed files with 11 additions and 3 deletions

View file

@ -604,7 +604,7 @@
"description": "anv: set missing protected bit for protected depth/stencil surfaces",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "794b0496e9467d27211d11fe7f783db3ce6a349a",
"notes": null

View file

@ -5265,8 +5265,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) {
@ -5303,8 +5307,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);