aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/wayland/native_wayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/egl/wayland/native_wayland.c')
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index 0292d5631d6..3d1bb6ff8b1 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -459,9 +459,17 @@ static struct native_display *
native_create_display(void *dpy, boolean use_sw, void *user_data)
{
struct wayland_display *display = NULL;
+ boolean own_dpy = FALSE;
use_sw = use_sw || debug_get_bool_option("EGL_SOFTWARE", FALSE);
+ if (dpy == NULL) {
+ dpy = wl_display_connect(NULL);
+ if (dpy == NULL)
+ return NULL;
+ own_dpy = TRUE;
+ }
+
if (use_sw) {
_eglLog(_EGL_INFO, "use software fallback");
display = wayland_create_shm_display((struct wl_display *) dpy,
@@ -482,6 +490,8 @@ native_create_display(void *dpy, boolean use_sw, void *user_data)
display->base.create_window_surface = wayland_create_window_surface;
display->base.create_pixmap_surface = wayland_create_pixmap_surface;
+ display->own_dpy = own_dpy;
+
return &display->base;
}