close(dri2_dpy->fd);
if (dri2_dpy->driver)
dlclose(dri2_dpy->driver);
- free(dri2_dpy->device_name);
free(dri2_dpy->driver_name);
+#ifdef HAVE_WAYLAND_PLATFORM
+ free(dri2_dpy->device_name);
+#endif
+
switch (disp->Platform) {
#ifdef HAVE_X11_PLATFORM
case _EGL_PLATFORM_X11:
struct gbm_dri_device *gbm_dri;
#endif
- char *device_name;
char *driver_name;
__DRIdri2LoaderExtension dri2_loader_extension;
int authenticated;
int formats;
uint32_t capabilities;
+ char *device_name;
#endif
int is_render_node;
goto cleanup;
dri2_dpy->fd = fd;
- dri2_dpy->device_name = loader_get_device_name_for_fd(dri2_dpy->fd);
dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->base.driver_name);
dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;
#ifdef HAVE_WAYLAND_PLATFORM
if (dri2_dpy->image) {
+ dri2_dpy->device_name = loader_get_device_name_for_fd(dri2_dpy->fd);
+
if (dri2_dpy->image->base.version >= 10 &&
dri2_dpy->image->getCapabilities != NULL) {
int capabilities;
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;
}
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;
static int
dri3_authenticate(_EGLDisplay *disp, uint32_t id)
{
+#ifdef HAVE_WAYLAND_PLATFORM
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
if (dri2_dpy->device_name) {
_eglLog(_EGL_WARNING,
"Wayland client primary node authentication isn't supported");
+#endif
return -1;
}
return EGL_FALSE;
}
- /* Only try to get a render device name since it's only needed for
- * WL_bind_wayland_display and dri3 doesn't provide a mechanism for
- * authenticating client opened device node fds. If this fails then
- * don't advertise the extension. */
+#ifdef HAVE_WAYLAND_PLATFORM
+ /* Only try to get a render device name since dri3 doesn't provide a
+ * mechanism for authenticating client opened device node fds. If this
+ * fails then don't advertise the extension. */
dri2_dpy->device_name = drmGetRenderDeviceNameFromFd(dri2_dpy->fd);
+#endif
return EGL_TRUE;
}