egl: don't expose swrast device if swrast is not built
authorMarek Olšák <marek.olsak@amd.com>
Fri, 27 Jan 2023 03:29:19 +0000 (22:29 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 22 Mar 2023 18:23:37 +0000 (18:23 +0000)
This fixes piglit/egl_ext_device_base without swrast.

Reviewed-by: Yogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20951>

src/egl/main/egldevice.c
src/egl/meson.build

index 66f17db..39a1237 100644 (file)
@@ -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;
    }
index 708c120..ac9a48e 100644 (file)
@@ -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',