From 54ea4087427e2a13adbe3cc82ff2115f69cee088 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 7 Dec 2023 10:30:03 -0400 Subject: [PATCH] asahi: allow compressed image stores in blits Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 30 +++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 14a6be4a9c2..a26baa4a2a7 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -118,23 +118,27 @@ agx_set_shader_images(struct pipe_context *pctx, enum pipe_shader_type shader, /* Images writeable with pixel granularity are incompatible with * compression. Decompress if necessary. + * + * Driver-internal images are used by the compute blitter and are exempt + * from these transitions, as it only uses compressed images when safe. */ - struct agx_resource *rsrc = agx_resource(image->resource); - if (!rsrc->layout.writeable_image && - (image->shader_access & PIPE_IMAGE_ACCESS_WRITE)) { + if (!(image->access & PIPE_IMAGE_ACCESS_DRIVER_INTERNAL)) { + struct agx_resource *rsrc = agx_resource(image->resource); + if (!rsrc->layout.writeable_image && + (image->shader_access & PIPE_IMAGE_ACCESS_WRITE)) { - agx_decompress(ctx, rsrc, "Shader image"); + agx_decompress(ctx, rsrc, "Shader image"); + } + + /* Readable images may be compressed but are still subject to format + * reinterpretation rules. + */ + agx_legalize_compression(ctx, rsrc, image->format); + + if (image->shader_access & PIPE_IMAGE_ACCESS_WRITE) + assert(rsrc->layout.writeable_image); } - /* Readable images may be compressed but are still subject to format - * reinterpretation rules. - */ - agx_legalize_compression(ctx, rsrc, image->format); - - if (image->shader_access & PIPE_IMAGE_ACCESS_WRITE) - assert(rsrc->layout.writeable_image); - - /* FIXME: Decompress here once we have texture compression */ util_copy_image_view(&ctx->stage[shader].images[start_slot + i], image); }