From 48e218b49d6bdfd167b755e3983bce4f14132347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 26 Jan 2023 22:29:19 -0500 Subject: [PATCH] egl: don't expose swrast device if swrast is not built This fixes piglit/egl_ext_device_base without swrast. Reviewed-by: Yogesh Mohan Marimuthu Part-of: --- src/egl/main/egldevice.c | 8 +++++++- src/egl/meson.build | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c index 66f17db0522..39a123792c8 100644 --- a/src/egl/main/egldevice.c +++ b/src/egl/main/egldevice.c @@ -316,7 +316,13 @@ _eglQueryDevicesEXT(EGLint max_devices, num_devs = _eglRefreshDeviceList(); devs = _eglGlobal.DeviceList; + +#ifdef GALLIUM_SOFTPIPE swrast = devs; +#else + swrast = NULL; + num_devs--; +#endif /* The first device is swrast. Start with the non-swrast device. */ devs = devs->Next; @@ -340,7 +346,7 @@ _eglQueryDevicesEXT(EGLint max_devices, } /* User requested the full device list, add the sofware device. */ - if (max_devices >= num_devs) { + if (max_devices >= num_devs && swrast) { assert(_eglDeviceSupports(swrast, _EGL_DEVICE_SOFTWARE)); devices[num_devs - 1] = swrast; } diff --git a/src/egl/meson.build b/src/egl/meson.build index 708c1206b97..ac9a48e0990 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -28,6 +28,10 @@ link_for_egl = [] deps_for_egl = [] incs_for_egl = [inc_include, inc_src, inc_egl] +if with_gallium_softpipe + c_args_for_egl += '-DGALLIUM_SOFTPIPE' +endif + files_egl = files( 'main/eglapi.c', 'main/eglarray.c',