Mesa (master): egl_dri2/wayland: Add support for EGL_DEFAULT_DISPLAY

Kristian Høgsberg krh at kemper.freedesktop.org
Sun Jun 12 12:58:48 UTC 2011


Module: Mesa
Branch: master
Commit: b8325fd2554aafde3d0b784b7944b1473af7d144
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8325fd2554aafde3d0b784b7944b1473af7d144

Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Sat Jun 11 22:07:02 2011 +0200

egl_dri2/wayland: Add support for EGL_DEFAULT_DISPLAY

---

 src/egl/drivers/dri2/egl_dri2.c         |   18 ++++++++++++++++--
 src/egl/drivers/dri2/platform_wayland.c |    8 +++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index ea8c8fb..a943005 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -528,10 +528,24 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
    if (dri2_dpy->fd)
       close(dri2_dpy->fd);
    dlclose(dri2_dpy->driver);
+
+   if (disp->PlatformDisplay == NULL) {
+      switch (disp->Platform) {
 #ifdef HAVE_X11_PLATFORM
-   if (disp->PlatformDisplay == NULL)
-      xcb_disconnect(dri2_dpy->conn);
+      case _EGL_PLATFORM_X11:
+         xcb_disconnect(dri2_dpy->conn);
+         break;
+#endif
+#ifdef HAVE_WAYLAND_PLATFORM
+      case _EGL_PLATFORM_WAYLAND:
+         wl_display_destroy(dri2_dpy->wl_dpy);
+         break;
 #endif
+      default:
+         break;
+      }
+   }
+
    free(dri2_dpy);
    disp->DriverData = NULL;
 
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 1d6ce2e..e786780 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -676,7 +676,13 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
    memset(dri2_dpy, 0, sizeof *dri2_dpy);
 
    disp->DriverData = (void *) dri2_dpy;
-   dri2_dpy->wl_dpy = disp->PlatformDisplay;
+   if (disp->PlatformDisplay == NULL) {
+      dri2_dpy->wl_dpy = wl_display_connect(NULL);
+      if (dri2_dpy->wl_dpy == NULL)
+         goto cleanup_dpy;
+   } else {
+      dri2_dpy->wl_dpy = disp->PlatformDisplay;
+   }
 
    id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
    if (id == 0)




More information about the mesa-commit mailing list