From f82264fec0e88d3591f28aebea51f8a2e89e3029 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 20 Nov 2023 12:11:01 -0400 Subject: [PATCH] asahi: return GL_OOM for excessive image sizes fixes piglit max-texture-size Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 74003e542f1..eec74b95e68 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -567,6 +567,12 @@ agx_resource_create_with_modifiers(struct pipe_screen *screen, ail_make_miptree(&nresource->layout); + /* Fail Piglit's obnoxious allocations */ + if (nresource->layout.size_B >= (1ull << 32)) { + free(nresource); + return NULL; + } + if (templ->target == PIPE_BUFFER) { assert(nresource->layout.tiling == AIL_TILING_LINEAR); util_range_init(&nresource->valid_buffer_range);