diff options
author | Frank Binns <[email protected]> | 2016-06-17 18:41:22 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-09-01 15:47:58 +0100 |
commit | d6f669ba834697b7321c7ea2cbb38794385c7205 (patch) | |
tree | 73d0d46a5925f2729eb1edc5ba20f209b363cf69 /src/egl/drivers/dri2/platform_x11.c | |
parent | 2dc6930a5a54c0f586ba09437123c380f3eae456 (diff) |
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 <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/platform_x11.c')
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 21 |
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 c8a9808a811..179152f8157 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; |