- nprobe = (struct native_probe *) _eglGetProbeCache(gdrv->probe_key);
- if (nprobe && (!dpy || nprobe->display == dpy->NativeDisplay)) {
- nprobe->destroy(nprobe);
- _eglSetProbeCache(gdrv->probe_key, NULL);
+ if (!gdrv->platforms[plat]) {
+ const char *plat_name = NULL;
+ const struct native_platform *nplat = NULL;
+
+ switch (plat) {
+ case _EGL_PLATFORM_WINDOWS:
+ plat_name = "Windows";
+#ifdef HAVE_GDI_BACKEND
+ nplat = native_get_gdi_platform(&egl_g3d_native_event_handler);
+#endif
+ break;
+ case _EGL_PLATFORM_X11:
+ plat_name = "X11";
+#ifdef HAVE_X11_BACKEND
+ nplat = native_get_x11_platform(&egl_g3d_native_event_handler);
+#endif
+ break;
+ case _EGL_PLATFORM_WAYLAND:
+ plat_name = "wayland";
+#ifdef HAVE_WAYLAND_BACKEND
+ nplat = native_get_wayland_platform(&egl_g3d_native_event_handler);
+#endif
+ break;
+ case _EGL_PLATFORM_DRM:
+ plat_name = "DRM";
+#ifdef HAVE_DRM_BACKEND
+ nplat = native_get_drm_platform(&egl_g3d_native_event_handler);
+#endif
+ break;
+ case _EGL_PLATFORM_FBDEV:
+ plat_name = "FBDEV";
+#ifdef HAVE_FBDEV_BACKEND
+ nplat = native_get_fbdev_platform(&egl_g3d_native_event_handler);
+#endif
+ break;
+ default:
+ break;
+ }
+
+ if (!nplat)
+ _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
+
+ gdrv->platforms[plat] = nplat;