egl/drm: move teardown code to the platform file
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 9 Nov 2017 19:04:25 +0000 (19:04 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 16 Nov 2017 14:03:08 +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_drm.c

index 280e70c137a6f9bc579fa9af216af735d67dec94..fc56e6357a6010a64ac5b713c2055747ffa6e6a0 100644 (file)
@@ -991,13 +991,9 @@ dri2_display_destroy(_EGLDisplay *disp)
    case _EGL_PLATFORM_X11:
       dri2_teardown_x11(dri2_dpy);
       break;
-#ifdef HAVE_DRM_PLATFORM
    case _EGL_PLATFORM_DRM:
-      if (dri2_dpy->own_device) {
-         gbm_device_destroy(&dri2_dpy->gbm_dri->base);
-      }
+      dri2_teardown_drm(disp);
       break;
-#endif
 #ifdef HAVE_WAYLAND_PLATFORM
    case _EGL_PLATFORM_WAYLAND:
       if (dri2_dpy->wl_drm)
index ef5a458f5dd796faec25e69eb226dfc71d2b9d68..9222fa122b203f1c878fe8eb9c0f5c1d7e73502b 100644 (file)
@@ -418,12 +418,16 @@ dri2_teardown_x11(struct dri2_egl_display *dri2_dpy) {}
 #ifdef HAVE_DRM_PLATFORM
 EGLBoolean
 dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
+void
+dri2_teardown_drm(struct dri2_egl_display *dri2_dpy);
 #else
 static inline EGLBoolean
 dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
 {
    return _eglError(EGL_NOT_INITIALIZED, "GBM/DRM platform not built");
 }
+static inline void
+dri2_teardown_drm(struct dri2_egl_display *dri2_dpy) {}
 #endif
 
 #ifdef HAVE_WAYLAND_PLATFORM
index 9005f5dd9ec3de0652b839d97508f9fa841d7232..416fd4cc657bb975e3781c1a243af536c00fb34c 100644 (file)
@@ -741,3 +741,10 @@ cleanup:
    dri2_display_destroy(disp);
    return _eglError(EGL_NOT_INITIALIZED, err);
 }
+
+void
+dri2_teardown_drm(struct dri2_egl_display *dri2_dpy)
+{
+   if (dri2_dpy->own_device)
+      gbm_device_destroy(&dri2_dpy->gbm_dri->base);
+}