From bc14dd98e36d0325eda21e41ad67c5361b18baf1 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 15 Oct 2025 23:21:48 -0400 Subject: [PATCH] tu: Clear RB_MRT_BUF_INFO::LOSSLESSCOMPEN for stencil This was already present in the 2d paths but not in the 3d path, probably because the flag was moved there only on a7xx and it was missed. Prevents page faults from bad flag buffer accesses. Part-of: --- src/freedreno/vulkan/tu_clear_blit.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/freedreno/vulkan/tu_clear_blit.cc b/src/freedreno/vulkan/tu_clear_blit.cc index 1fce5a04adc..7a14882c712 100644 --- a/src/freedreno/vulkan/tu_clear_blit.cc +++ b/src/freedreno/vulkan/tu_clear_blit.cc @@ -1401,12 +1401,19 @@ r3d_dst_depth(struct tu_cs *cs, const struct tu_image_view *iview, uint32_t laye tu_cs_emit_regs(cs, A7XX_GRAS_SU_RENDER_CNTL()); } +static uint32_t +tu_rb_mrt_buf_info_stencil(const struct tu_image_view *iview) +{ + return tu_image_view_stencil(iview, RB_MRT_BUF_INFO) & + ~A7XX_RB_MRT_BUF_INFO_LOSSLESSCOMPEN; +} + template static void r3d_dst_stencil(struct tu_cs *cs, const struct tu_image_view *iview, uint32_t layer) { tu_cs_emit_regs(cs, - RB_MRT_BUF_INFO(CHIP, 0, .dword = tu_image_view_stencil(iview, RB_MRT_BUF_INFO)), + RB_MRT_BUF_INFO(CHIP, 0, .dword = tu_rb_mrt_buf_info_stencil(iview)), A6XX_RB_MRT_PITCH(0, iview->stencil_pitch), A6XX_RB_MRT_ARRAY_PITCH(0, iview->stencil_layer_size), A6XX_RB_MRT_BASE(0, .qword = iview->stencil_base_addr + iview->stencil_layer_size * layer), @@ -1453,7 +1460,7 @@ r3d_dst_gmem(struct tu_cmd_buffer *cmd, struct tu_cs *cs, RB_MRT_BUF_INFO = tu_image_view_depth(iview, RB_MRT_BUF_INFO); gmem_offset = tu_attachment_gmem_offset(cmd, att, layer); } else { - RB_MRT_BUF_INFO = tu_image_view_stencil(iview, RB_MRT_BUF_INFO); + RB_MRT_BUF_INFO = tu_rb_mrt_buf_info_stencil(iview); gmem_offset = tu_attachment_gmem_offset_stencil(cmd, att, layer); } } else {