From 692206d58c1ec6e08c803b71164136c25ff12efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 4 Aug 2025 23:51:16 -0400 Subject: [PATCH] dri: fail creating DRI images that exceed hw limits otherwise random stuff happens it probably resolves https://gitlab.freedesktop.org/mesa/mesa/-/issues/13652 Reviewed-by: Simon Ser Reviewed-by: Mike Blumenkrantz Part-of: --- src/gallium/frontends/dri/dri2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 9e83343359a..082d38b6c21 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -916,6 +916,10 @@ dri_create_image(struct dri_screen *screen, if (!pscreen->resource_create_with_modifiers && count > 0) return NULL; + if (width > pscreen->caps.max_texture_2d_size || + height > pscreen->caps.max_texture_2d_size) + return NULL; + if (pscreen->is_format_supported(pscreen, map->pipe_format, screen->target, 0, 0, PIPE_BIND_RENDER_TARGET)) tex_usage |= PIPE_BIND_RENDER_TARGET;