From 04f6e24e65893b84d0d8bcf222b36c1fefcda7d8 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 18 Sep 2025 15:28:34 +0200 Subject: [PATCH] r600/sfn: clear PIPE_MAP_UNSYNCRONIZED for partial DS texture writes When writing to a depth texture the driver is first doing a decompress blit to a stageing resource. On one hand this blit can be skipped, if PIPE_MAP_DISCARD_WHOLE_RESOURCE is set, OTOH we need to clear the PIPE_MAP_UNSYNCHRONIZED flag if a partial write is done, because we have to wait until the blit is finished. v2: Update the patch with a more targeted approach. Fixes: 25b97a3a96a ("mesa/st: mark internal texture map calls as UNSYNCHRONIZED") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13916 Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/r600_texture.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 19d27ffe641..5dde97bcdff 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -1381,10 +1381,16 @@ void *r600_texture_transfer_map(struct pipe_context *ctx, return NULL; } - rctx->blit_decompress_depth(ctx, rtex, staging_depth, - level, level, - box->z, box->z + box->depth - 1, - 0, 0); + if (!(usage & PIPE_MAP_DISCARD_WHOLE_RESOURCE)) { + rctx->blit_decompress_depth(ctx, rtex, staging_depth, + level, level, + box->z, box->z + box->depth - 1, + 0, 0); + /* Since we have to wait for the blit_decompress_depth to finish, + * we have to clear PIPE_MAP_UNSYNCHRONIZED here. + */ + usage &= ~PIPE_MAP_UNSYNCHRONIZED; + } offset = r600_texture_get_offset(rctx->screen, staging_depth, level, box,