From c9b2bf84e51c4d45fc727284ceab5ffd6e9fa29d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 7 Dec 2023 19:17:35 -0400 Subject: [PATCH] asahi: do not stall for writers with invalid mips Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 6e10cd03c64..b3f49a69e52 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -762,6 +762,13 @@ agx_prepare_for_map(struct agx_context *ctx, struct agx_resource *rsrc, if (staging_blit) return; + /* If the level has not been written, we may freely do CPU access (writes), + * even if other levels are being written by the GPU. This lets us write some + * mip levels on the CPU and some on the GPU, without stalling. + */ + if (!agx_resource_valid(rsrc, level)) + return; + /* Upgrade DISCARD_RANGE to WHOLE_RESOURCE if the whole resource is * being mapped. */