egl/wayland: move teardown code to the platform file
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 9 Nov 2017 19:13:09 +0000 (19:13 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 16 Nov 2017 14:03:10 +0000 (14:03 +0000)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_wayland.c

index fc56e6357a6010a64ac5b713c2055747ffa6e6a0..28a3591ed494784da3ffa7e2989982e1d2b2513a 100644 (file)
@@ -994,28 +994,9 @@ dri2_display_destroy(_EGLDisplay *disp)
    case _EGL_PLATFORM_DRM:
       dri2_teardown_drm(disp);
       break;
-#ifdef HAVE_WAYLAND_PLATFORM
    case _EGL_PLATFORM_WAYLAND:
-      if (dri2_dpy->wl_drm)
-          wl_drm_destroy(dri2_dpy->wl_drm);
-      if (dri2_dpy->wl_dmabuf)
-          zwp_linux_dmabuf_v1_destroy(dri2_dpy->wl_dmabuf);
-      if (dri2_dpy->wl_shm)
-          wl_shm_destroy(dri2_dpy->wl_shm);
-      if (dri2_dpy->wl_registry)
-         wl_registry_destroy(dri2_dpy->wl_registry);
-      if (dri2_dpy->wl_queue)
-         wl_event_queue_destroy(dri2_dpy->wl_queue);
-      if (dri2_dpy->wl_dpy_wrapper)
-         wl_proxy_wrapper_destroy(dri2_dpy->wl_dpy_wrapper);
-      u_vector_finish(&dri2_dpy->wl_modifiers.argb8888);
-      u_vector_finish(&dri2_dpy->wl_modifiers.xrgb8888);
-      u_vector_finish(&dri2_dpy->wl_modifiers.rgb565);
-      if (dri2_dpy->own_device) {
-         wl_display_disconnect(dri2_dpy->wl_dpy);
-      }
+      dri2_teardown_wayland(disp);
       break;
-#endif
    default:
       break;
    }
index 9222fa122b203f1c878fe8eb9c0f5c1d7e73502b..ef375b68f8239f8db52f865245f8ff036c8f2b8c 100644 (file)
@@ -433,12 +433,16 @@ dri2_teardown_drm(struct dri2_egl_display *dri2_dpy) {}
 #ifdef HAVE_WAYLAND_PLATFORM
 EGLBoolean
 dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
+void
+dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy);
 #else
 static inline EGLBoolean
 dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 {
    return _eglError(EGL_NOT_INITIALIZED, "Wayland platform not built");
 }
+static inline void
+dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy) {}
 #endif
 
 #ifdef HAVE_ANDROID_PLATFORM
index 7010dfdcb2beeafe30d8a23d373a2ce1f11c17ed..2aecce35f998beda47c3ca77a085e1e53c0d0b80 100644 (file)
@@ -2008,3 +2008,25 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
    return initialized;
 
 }
+
+void
+dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy)
+{
+   if (dri2_dpy->wl_drm)
+      wl_drm_destroy(dri2_dpy->wl_drm);
+   if (dri2_dpy->wl_dmabuf)
+      zwp_linux_dmabuf_v1_destroy(dri2_dpy->wl_dmabuf);
+   if (dri2_dpy->wl_shm)
+      wl_shm_destroy(dri2_dpy->wl_shm);
+   if (dri2_dpy->wl_registry)
+      wl_registry_destroy(dri2_dpy->wl_registry);
+   if (dri2_dpy->wl_queue)
+      wl_event_queue_destroy(dri2_dpy->wl_queue);
+   if (dri2_dpy->wl_dpy_wrapper)
+      wl_proxy_wrapper_destroy(dri2_dpy->wl_dpy_wrapper);
+   u_vector_finish(&dri2_dpy->wl_modifiers.argb8888);
+   u_vector_finish(&dri2_dpy->wl_modifiers.xrgb8888);
+   u_vector_finish(&dri2_dpy->wl_modifiers.rgb565);
+   if (dri2_dpy->own_device)
+      wl_display_disconnect(dri2_dpy->wl_dpy);
+}