From a88aa3e8350ced14a4a3ae24af12447067ce55d3 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Fri, 9 Dec 2022 20:16:28 +0900 Subject: [PATCH] asahi: Refuse to transfer out-of-bounds mip levels Fixes ail asserts on a pile of dEQP3 tests. Signed-off-by: Asahi Lina Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 5b39955c199..689b66fef3b 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -742,6 +742,10 @@ agx_transfer_map(struct pipe_context *pctx, struct pipe_resource *resource, if ((usage & PIPE_MAP_DIRECTLY) && rsrc->modifier != DRM_FORMAT_MOD_LINEAR) return NULL; + /* Can't transfer out of bounds mip levels */ + if (level >= rsrc->layout.levels) + return NULL; + agx_prepare_for_map(ctx, rsrc, level, usage, box); struct agx_transfer *transfer = CALLOC_STRUCT(agx_transfer);