From 5e5bc7a1c728693b97d45b13c3a5eabc6313e9db Mon Sep 17 00:00:00 2001 From: Christoph Neuhauser Date: Mon, 29 Sep 2025 11:55:10 +0200 Subject: [PATCH] egl: Fix invalid device UUID returned by EGL_EXT_device_persistent_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MR !36998 / commit 72f2565fc99ea80b7f7ddc4392ef2313edf96692 introduced an issue where QueryDeviceInfo is not called in eglQueryDeviceBinaryEXT, which causes the queried UUID to always be zero. This commit fixes the issue by adding a call to QueryDeviceInfo. Also, it refactors the inconsistent function names passed to _eglError. Signed-off-by: Christoph Neuhauser Reviewed-by: Tapani Pälli Cc: mesa-stable Part-of: --- src/egl/main/egldevice.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c index 96e483da79a..ba2f59f9e6e 100644 --- a/src/egl/main/egldevice.c +++ b/src/egl/main/egldevice.c @@ -295,6 +295,15 @@ _eglQueryDeviceBinaryEXT(_EGLDevice *dev, EGLint name, EGLint max_size, } #ifdef HAVE_LIBDRM + drmDevicePtr device = _eglDeviceDrm(dev); + /* Software device does not have render node. */ + const char *render_node = + _eglDeviceSupports(dev, _EGL_DEVICE_SOFTWARE) ? + "" : device->nodes[DRM_NODE_RENDER]; + if (!_eglDriver.QueryDeviceInfo(render_node, &dev->device_info)) { + _eglError(EGL_BAD_DEVICE_EXT, "eglQueryDeviceBinaryEXT"); + return EGL_FALSE; + } if (value && name == EGL_DEVICE_UUID_EXT) { memcpy(value, dev->device_info.device_uuid, EGL_UUID_SIZE); } @@ -361,7 +370,7 @@ _eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name) break; #ifdef HAVE_LIBDRM if (!_eglDriver.QueryDeviceInfo(render_node, &dev->device_info)) { - _eglError(EGL_BAD_DEVICE_EXT, "_eglQueryDeviceStringEXT"); + _eglError(EGL_BAD_DEVICE_EXT, "eglQueryDeviceStringEXT"); return NULL; } return dev->device_info.vendor_name; @@ -375,7 +384,7 @@ _eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name) break; #ifdef HAVE_LIBDRM if (!_eglDriver.QueryDeviceInfo(render_node, &dev->device_info)) { - _eglError(EGL_BAD_DEVICE_EXT, "_eglQueryDeviceStringEXT"); + _eglError(EGL_BAD_DEVICE_EXT, "eglQueryDeviceStringEXT"); return NULL; } return dev->device_info.renderer_name; @@ -390,7 +399,7 @@ _eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name) break; #ifdef HAVE_LIBDRM if (!_eglDriver.QueryDeviceInfo(render_node, &dev->device_info)) { - _eglError(EGL_BAD_DEVICE_EXT, "_eglQueryDeviceStringEXT"); + _eglError(EGL_BAD_DEVICE_EXT, "eglQueryDeviceStringEXT"); return NULL; } return dev->device_info.driver_name;