summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_x11.c
diff options
context:
space:
mode:
authorFrank Binns <frank.binns@imgtec.com>2016-06-17 18:41:22 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2016-09-01 15:47:58 +0100
commitd6f669ba834697b7321c7ea2cbb38794385c7205 (patch)
tree73d0d46a5925f2729eb1edc5ba20f209b363cf69 /src/egl/drivers/dri2/platform_x11.c
parent2dc6930a5a54c0f586ba09437123c380f3eae456 (diff)
downloadexternal_mesa3d-d6f669ba834697b7321c7ea2cbb38794385c7205.zip
external_mesa3d-d6f669ba834697b7321c7ea2cbb38794385c7205.tar.gz
external_mesa3d-d6f669ba834697b7321c7ea2cbb38794385c7205.tar.bz2
egl: only store device name when Wayland support is built
The device name is only needed for WL_bind_wayland_display so make this clear by only storing the device name when Wayland support is built. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'src/egl/drivers/dri2/platform_x11.c')
-rw-r--r--src/egl/drivers/dri2/platform_x11.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index c8a9808..179152f 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -665,23 +665,16 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
device_name = xcb_dri2_connect_device_name (connect);
- dri2_dpy->device_name =
- strndup(device_name,
- xcb_dri2_connect_device_name_length(connect));
-
- dri2_dpy->fd = loader_open_device(dri2_dpy->device_name);
+ dri2_dpy->fd = loader_open_device(device_name);
if (dri2_dpy->fd == -1) {
_eglLog(_EGL_WARNING,
- "DRI2: could not open %s (%s)", dri2_dpy->device_name,
- strerror(errno));
- free(dri2_dpy->device_name);
+ "DRI2: could not open %s (%s)", device_name, strerror(errno));
free(connect);
return EGL_FALSE;
}
if (!dri2_x11_local_authenticate(dri2_dpy)) {
close(dri2_dpy->fd);
- free(dri2_dpy->device_name);
free(connect);
return EGL_FALSE;
}
@@ -700,13 +693,19 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
xcb_dri2_connect_driver_name_length(connect));
}
- if (dri2_dpy->device_name == NULL || dri2_dpy->driver_name == NULL) {
+ if (dri2_dpy->driver_name == NULL) {
close(dri2_dpy->fd);
- free(dri2_dpy->device_name);
free(dri2_dpy->driver_name);
free(connect);
return EGL_FALSE;
}
+
+#ifdef HAVE_WAYLAND_PLATFORM
+ dri2_dpy->device_name =
+ strndup(device_name,
+ xcb_dri2_connect_device_name_length(connect));
+#endif
+
free(connect);
return EGL_TRUE;