diff options
author | Xuelian Bai <xuelian.bai@samsung.com> | 2018-06-08 17:35:42 +0800 |
---|---|---|
committer | Xuelian Bai <xuelian.bai@samsung.com> | 2019-04-08 23:00:54 +0800 |
commit | 8bdd1e03c0960945dffbdbeb67fe734fe92c2e0b (patch) | |
tree | 32f81ccd09f57559fd8564416c19a223d8ce64d7 | |
parent | dc23862fb508a88469dfb646071d3d41155c4bf2 (diff) | |
download | mesa-8bdd1e03c0960945dffbdbeb67fe734fe92c2e0b.tar.gz mesa-8bdd1e03c0960945dffbdbeb67fe734fe92c2e0b.tar.bz2 mesa-8bdd1e03c0960945dffbdbeb67fe734fe92c2e0b.zip |
Release drm_fd when release tizen display
Change-Id: Ia08f9bfbb440be03f7a41a6d54a12e7834838ce3
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 5 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 10 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_tizen.c | 17 |
3 files changed, 27 insertions, 5 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index ec751183f03..45433cd87b1 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -969,10 +969,7 @@ dri2_display_destroy(_EGLDisplay *disp) #ifdef HAVE_TIZEN_PLATFORM case _EGL_PLATFORM_TIZEN: - if (dri2_dpy->tpl_display) - tpl_object_unreference((tpl_object_t *)(dri2_dpy->tpl_display)); - if (dri2_dpy->own_device) - wl_display_disconnect(disp->PlatformDisplay); + dri2_teardown_tizen(disp); break; #endif default: diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index cd0d4a26d9e..4f9f9423a8f 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -522,8 +522,18 @@ dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp) } #endif +#ifdef HAVE_TIZEN_PLATFORM EGLBoolean dri2_initialize_tizen(_EGLDriver *drv, _EGLDisplay *disp); +void +dri2_teardown_tizen(_EGLDisplay *disp); +#else +static inline EGLBoolean +dri2_initialize_tizen(_EGLDriver *drv, _EGLDisplay *disp) +{ + return _eglError(EGL_NOT_INITIALIZED, "tizen platform not built"); +} +#endif void dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw); diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c index 846bc6ff964..4b5b8bd6634 100644 --- a/src/egl/drivers/dri2/platform_tizen.c +++ b/src/egl/drivers/dri2/platform_tizen.c @@ -49,6 +49,7 @@ #include <wayland-client.h> +int tbm_bufmgr_fd = -1; static void tizen_free_local_buffers(struct dri2_egl_surface *dri2_surf); /* createImageFromFds requires fourcc format */ @@ -1401,7 +1402,6 @@ dri2_initialize_tizen(_EGLDriver *drv, _EGLDisplay *disp) struct dri2_egl_display *dri2_dpy; tpl_display_t *tpl_display = NULL; const char *err; - int tbm_bufmgr_fd = -1; char *tbm_bufmgr_device_name = NULL; int hw_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); @@ -1555,3 +1555,18 @@ cleanup_display: return _eglError(EGL_NOT_INITIALIZED, err); } + +void +dri2_teardown_tizen(_EGLDisplay *disp) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + + if (dri2_dpy->tpl_display) + tpl_object_unreference((tpl_object_t *)(dri2_dpy->tpl_display)); + + if (tbm_bufmgr_fd > 0) + close(tbm_bufmgr_fd); + + if (dri2_dpy->own_device) + wl_display_disconnect(disp->PlatformDisplay); +} |