[Mesa-dev] [PATCH 3/5] egl/drm: move teardown code to the platform file
Emil Velikov
emil.l.velikov at gmail.com
Mon Nov 13 14:06:12 UTC 2017
From: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/egl/drivers/dri2/egl_dri2.c | 6 +-----
src/egl/drivers/dri2/egl_dri2.h | 4 ++++
src/egl/drivers/dri2/platform_drm.c | 7 +++++++
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 280e70c137a..fc56e6357a6 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -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)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index ef5a458f5dd..9222fa122b2 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -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
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 9005f5dd9ec..416fd4cc657 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -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);
+}
--
2.15.0
More information about the mesa-dev
mailing list