From c334ade0c261e6dc39a87af43521df56dde72cb1 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Fri, 19 Sep 2025 15:38:48 +0800 Subject: [PATCH] gallium: fix eglExportDMABUFImageQueryMESA crash for r600 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit r600 does not implement pipe_screen.resource_get_param, so dri2_resource_get_param just return false here. eglExportDMABUFImageQueryMESA has been changed to support multi plane resource, so some emulated multi plane format gets here and return NULL which causes following queries with this return value crash. Fixes: f416a52960b ("egl: refine dma buf export to support multi plane") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13921 Reviewed-by: Marek Olšák Part-of: --- src/gallium/frontends/dri/dri2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 7881407f569..e4304bd72af 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -1265,9 +1265,8 @@ dri2_from_planar(struct dri_image *image, int plane, void *loaderPrivate) if (plane < 0) { return NULL; } else if (plane > 0) { - uint64_t planes; - if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_NPLANES, 0, - &planes) || + int planes; + if (!dri2_query_image(image, __DRI_IMAGE_ATTRIB_NUM_PLANES, &planes) || plane >= planes) { return NULL; }