On 2 May 2015 at 11:15, Axel Davy <axel.d...@ens.fr> wrote: > It is possible the server advertises a render-node. > In that case no authentication is needed, > and Gem names are forbidden. > > Signed-off-by: Axel Davy <axel.d...@ens.fr> > ---
> diff --git a/src/egl/drivers/dri2/platform_wayland.c > b/src/egl/drivers/dri2/platform_wayland.c > index a5bcf25..79989cb 100644 > --- a/src/egl/drivers/dri2/platform_wayland.c > +++ b/src/egl/drivers/dri2/platform_wayland.c > @@ -800,12 +800,33 @@ bad_format: > return NULL; > } > > +static char > +is_fd_render_node(int fd) > +{ > + struct stat render; > + > + if (fstat(fd, &render)) > + return 0; > + > + if (!S_ISCHR(render.st_mode)) > + return 0; > + > + if (render.st_rdev & 0x80) > + return 1; > + return 0; > +} > + Let's use drmGetNodeTypeFromFd(), rather than hard-coding this ? > +static EGLBoolean > +is_render_node_capable(struct dri2_egl_display *dri2_dpy) > +{ > + const __DRIextension **extensions; > + int i; > + > + /* We cannot use Gem names with render-nodes, only prime fds (dma-buf). > + * The server needs to accept them */ > + if (!(dri2_dpy->capabilities & WL_DRM_CAPABILITY_PRIME)) > + return EGL_FALSE; > + > + /* Check the __DRIimage api is supported (this is required by our > + * codepath without Gem names) */ > + extensions = dri2_dpy->driver_extensions; > + for (i = 0; extensions[i]; i++) { > + if (strcmp(extensions[i]->name, __DRI_IMAGE_DRIVER) == 0) > + return EGL_TRUE; If memory serves me right__DRI_IMAGE_DRIVER is a cleaned up version of __DRI_DRI2. Afaics the former is never looked up (or used) in the EGL code, unlike the latter. So I'm suspecting that this check is a bit off ? Thanks Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev