diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 5 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 2 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 3 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 21 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11_dri3.c | 11 |
5 files changed, 24 insertions, 18 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 19f54dec660..859612f1b97 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -858,9 +858,12 @@ dri2_display_release(_EGLDisplay *disp) { 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: diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 7daec3ce5f4..b1cbf944dda 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -194,7 +194,6 @@ struct dri2_egl_display struct gbm_dri_device *gbm_dri; #endif - char *device_name; char *driver_name; __DRIdri2LoaderExtension dri2_loader_extension; @@ -221,6 +220,7 @@ struct dri2_egl_display int authenticated; int formats; uint32_t capabilities; + char *device_name; #endif int is_render_node; diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 1ce282fcaa6..e678db8991e 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -639,7 +639,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) 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; @@ -701,6 +700,8 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) #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; 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; diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index f996750b588..31649fe849e 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -229,6 +229,7 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, 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) { @@ -239,6 +240,7 @@ dri3_authenticate(_EGLDisplay *disp, uint32_t id) _eglLog(_EGL_WARNING, "Wayland client primary node authentication isn't supported"); +#endif return -1; } @@ -533,11 +535,12 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy) 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; } |