summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaowei yuan <zhaowei.yuan@samsung.com>2018-04-20 01:59:02 +0800
committerXuelian Bai <xuelian.bai@samsung.com>2019-04-08 22:46:44 +0800
commitdc23862fb508a88469dfb646071d3d41155c4bf2 (patch)
treec2e94b801e67e577bf255e485e82abf3a3979caf
parent5220c6c3274fd4d7eedd1d6b7a10d4efa9615bb8 (diff)
downloadmesa-dc23862fb508a88469dfb646071d3d41155c4bf2.tar.gz
mesa-dc23862fb508a88469dfb646071d3d41155c4bf2.tar.bz2
mesa-dc23862fb508a88469dfb646071d3d41155c4bf2.zip
Platform_tizen: Allocate native display for EGL_DEFAULT_DISPLAY
Allocate an new native display in dri2_initialize_tizen() if argument passed to eglGetDisplay() is EGL_DEFAULT_DISPLAY, or it will cause error in __tpl_wayland_egl_display_init() Change-Id: Ieb36263485d2f4276176c0b723da202bf10b78c5 Signed-off-by: zhaowei yuan <zhaowei.yuan@samsung.com>
-rw-r--r--configure.ac2
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c2
-rw-r--r--src/egl/drivers/dri2/platform_tizen.c14
3 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index cd7d660f03f..dcee3e24d58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1896,7 +1896,7 @@ for plat in $platforms; do
;;
tizen)
- PKG_CHECK_MODULES([TIZEN], [tpl-egl libtbm libtdm])
+ PKG_CHECK_MODULES([TIZEN], [tpl-egl libtbm libtdm wayland-client])
DEFINES="$DEFINES -DHAVE_TIZEN_PLATFORM"
;;
*)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c6054b91aec..ec751183f03 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -971,6 +971,8 @@ dri2_display_destroy(_EGLDisplay *disp)
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);
break;
#endif
default:
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index f2610105c16..846bc6ff964 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -47,6 +47,8 @@
#include "egl_dri2_fallbacks.h"
#include "loader.h"
+#include <wayland-client.h>
+
static void tizen_free_local_buffers(struct dri2_egl_surface *dri2_surf);
/* createImageFromFds requires fourcc format */
@@ -1410,6 +1412,14 @@ dri2_initialize_tizen(_EGLDriver *drv, _EGLDisplay *disp)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
disp->DriverData = (void *) dri2_dpy;
+ if (disp->PlatformDisplay == NULL) {
+ disp->PlatformDisplay = wl_display_connect(NULL);
+ if (disp->PlatformDisplay == NULL) {
+ err = "DRI2: failed to get native display";
+ goto cleanup_display;
+ }
+ dri2_dpy->own_device = 1;
+ }
/* TPL_BACKEND_UNKNOWN type make checking runtime type check */
tpl_display = tpl_display_create(TPL_BACKEND_UNKNOWN, disp->PlatformDisplay);
@@ -1536,6 +1546,10 @@ cleanup_device:
free(tbm_bufmgr_device_name);
tpl_object_unreference((tpl_object_t *)tpl_display);
cleanup_display:
+ if (dri2_dpy->own_device) {
+ wl_display_disconnect(disp->PlatformDisplay);
+ disp->PlatformDisplay = NULL;
+ }
free(dri2_dpy);
disp->DriverData = NULL;