From 611fcfc5cade53e8d7014033105c4ec8b2223a72 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 5 Dec 2023 13:06:06 -0400 Subject: [PATCH] asahi: do not use compression blits for uncompressed levels pointless, it's much faster to just twiddle on the cpu. use the helpers to detect compression per-level the right way. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/layout/tiling.c | 6 ++++-- src/gallium/drivers/asahi/agx_pipe.c | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/asahi/layout/tiling.c b/src/asahi/layout/tiling.c index 00e06808d3c..7fa6ceacb66 100644 --- a/src/asahi/layout/tiling.c +++ b/src/asahi/layout/tiling.c @@ -144,7 +144,8 @@ ail_detile(void *_tiled, void *_linear, struct ail_layout *tiled_layout, unsigned blocksize_B = util_format_get_blocksize(tiled_layout->format); assert(level < tiled_layout->levels && "Mip level out of bounds"); - assert(tiled_layout->tiling == AIL_TILING_TWIDDLED && "Invalid usage"); + assert(ail_is_level_twiddled_uncompressed(tiled_layout, level) && + "Invalid usage"); assert((sx_px + swidth_px) <= width_px && "Invalid usage"); assert((sy_px + sheight_px) <= height_px && "Invalid usage"); @@ -161,7 +162,8 @@ ail_tile(void *_tiled, void *_linear, struct ail_layout *tiled_layout, unsigned blocksize_B = util_format_get_blocksize(tiled_layout->format); assert(level < tiled_layout->levels && "Mip level out of bounds"); - assert(tiled_layout->tiling == AIL_TILING_TWIDDLED && "Invalid usage"); + assert(ail_is_level_twiddled_uncompressed(tiled_layout, level) && + "Invalid usage"); assert((sx_px + swidth_px) <= width_px && "Invalid usage"); assert((sy_px + sheight_px) <= height_px && "Invalid usage"); diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 6c882da4d3f..3f8143fc5c0 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -974,7 +974,7 @@ agx_transfer_map(struct pipe_context *pctx, struct pipe_resource *resource, * compression in software. In some cases, we could use this path for * twiddled too, but we don't have a use case for that yet. */ - if (rsrc->modifier == DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED) { + if (ail_is_level_compressed(&rsrc->layout, level)) { /* Should never happen for buffers, and it's not safe */ assert(resource->target != PIPE_BUFFER); @@ -1007,7 +1007,7 @@ agx_transfer_map(struct pipe_context *pctx, struct pipe_resource *resource, agx_bo_mmap(rsrc->bo); - if (rsrc->modifier == DRM_FORMAT_MOD_APPLE_TWIDDLED) { + if (ail_is_level_twiddled_uncompressed(&rsrc->layout, level)) { /* Should never happen for buffers, and it's not safe */ assert(resource->target != PIPE_BUFFER); @@ -1066,7 +1066,8 @@ agx_transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *transfer) agx_flush_readers(agx_context(pctx), agx_resource(trans->staging.rsrc), "GPU write staging blit"); } else if (trans->map && (transfer->usage & PIPE_MAP_WRITE)) { - assert(rsrc->modifier == DRM_FORMAT_MOD_APPLE_TWIDDLED); + assert( + ail_is_level_twiddled_uncompressed(&rsrc->layout, transfer->level)); for (unsigned z = 0; z < transfer->box.depth; ++z) { uint8_t *map =