egl/x11: move teardown code to the platform file
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 9 Nov 2017 18:58:52 +0000 (18:58 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 16 Nov 2017 14:03:06 +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_x11.c

index af8214253551f8f1f2e0fc24851de18fbc6912c8..280e70c137a6f9bc579fa9af216af735d67dec94 100644 (file)
@@ -988,13 +988,9 @@ dri2_display_destroy(_EGLDisplay *disp)
 #endif
 
    switch (disp->Platform) {
-#ifdef HAVE_X11_PLATFORM
    case _EGL_PLATFORM_X11:
-      if (dri2_dpy->own_device) {
-         xcb_disconnect(dri2_dpy->conn);
-      }
+      dri2_teardown_x11(dri2_dpy);
       break;
-#endif
 #ifdef HAVE_DRM_PLATFORM
    case _EGL_PLATFORM_DRM:
       if (dri2_dpy->own_device) {
index 9cccf05253a65ce73d604c9ef437cbaad2453e01..ef5a458f5dd796faec25e69eb226dfc71d2b9d68 100644 (file)
@@ -403,12 +403,16 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
 #ifdef HAVE_X11_PLATFORM
 EGLBoolean
 dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp);
+void
+dri2_teardown_x11(struct dri2_egl_display *dri2_dpy);
 #else
 static inline EGLBoolean
 dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
 {
    return _eglError(EGL_NOT_INITIALIZED, "X11 platform not built");
 }
+static inline void
+dri2_teardown_x11(struct dri2_egl_display *dri2_dpy) {}
 #endif
 
 #ifdef HAVE_DRM_PLATFORM
index 5bcdb2dac748cc0e99012ffa2d4b35eb384907e8..c49cb1fd8ef9be9ffc44b22c7f1e4a7998cfbf9d 100644 (file)
@@ -1476,3 +1476,9 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
    return initialized;
 }
 
+void
+dri2_teardown_x11(struct dri2_egl_display *dri2_dpy)
+{
+   if (dri2_dpy->own_device)
+      xcb_disconnect(dri2_dpy->conn);
+}