summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2014-01-28 18:53:56 -0800
committerChad Versace <[email protected]>2014-03-17 15:39:22 -0700
commitf506ef6784e79aeebd50184c034fc9723d6894db (patch)
tree348f5c2017130bad0e139623e7615a38b7834b6e /src/egl/drivers/dri2/egl_dri2.c
parent31cd0fee317c8532ac93f6de13c7955511f738a0 (diff)
egl/dri2: Consolidate eglTerminate
egl_dri2.c:dri2_terminate() handled terminating X11 and DRM displays. The Wayland platform implemented its own dri2_wl_terminate(), which was nearly a copy of the common one. To implement the EGL platform extensions, we either need to dispatch eglTerminate per display or define a common implementation for all platforms. This patch chooses consolidation. It removes dri2_wl_terminate() by folding it into the common dri2_terminate(). It was necessary to invert the `if (disp->PlatformDisplay == NULL)` and the switch statement because, unlike DRM and X11, Wayland's terminator performed action even when EGL didn't own the native display. In the inversion, I replaced `disp->PlatformDisplay == NULL` with `dri2_dpy->own_device` because the two expressions are synonymous, but the latter's meaning is clearer. Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.c')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 9074a81f90b..9e5b956bc82 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -25,6 +25,8 @@
* Kristian Høgsberg <[email protected]>
*/
+#define WL_HIDE_DEPRECATED
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -42,12 +44,13 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include "egl_dri2.h"
-
#ifdef HAVE_WAYLAND_PLATFORM
#include "wayland-drm.h"
+#include "wayland-drm-client-protocol.h"
#endif
+#include "egl_dri2.h"
+
const __DRIuseInvalidateExtension use_invalidate = {
{ __DRI_USE_INVALIDATE, 1 }
};
@@ -672,23 +675,31 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
dlclose(dri2_dpy->driver);
free(dri2_dpy->device_name);
- if (disp->PlatformDisplay == NULL) {
- switch (disp->Platform) {
+ switch (disp->Platform) {
#ifdef HAVE_X11_PLATFORM
- case _EGL_PLATFORM_X11:
+ case _EGL_PLATFORM_X11:
+ if (dri2_dpy->own_device) {
xcb_disconnect(dri2_dpy->conn);
- break;
+ }
+ break;
#endif
#ifdef HAVE_DRM_PLATFORM
- case _EGL_PLATFORM_DRM:
- if (dri2_dpy->own_device) {
- gbm_device_destroy(&dri2_dpy->gbm_dri->base.base);
- }
- break;
+ case _EGL_PLATFORM_DRM:
+ if (dri2_dpy->own_device) {
+ gbm_device_destroy(&dri2_dpy->gbm_dri->base.base);
+ }
+ break;
#endif
- default:
- break;
+#ifdef HAVE_WAYLAND_PLATFORM
+ case _EGL_PLATFORM_WAYLAND:
+ wl_drm_destroy(dri2_dpy->wl_drm);
+ if (dri2_dpy->own_device) {
+ wl_display_disconnect(dri2_dpy->wl_dpy);
}
+ break;
+#endif
+ default:
+ break;
}
free(dri2_dpy);