Mesa (master): egl/x11_dri3: provide an authentication function

Axel Davy axeldavy at kemper.freedesktop.org
Wed Aug 31 13:13:39 UTC 2016


Module: Mesa
Branch: master
Commit: 5505845945fb9bdd0c752b0f299a627591205dbd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5505845945fb9bdd0c752b0f299a627591205dbd

Author: Frank Binns <frank.binns at imgtec.com>
Date:   Fri Jun 17 18:41:21 2016 +0100

egl/x11_dri3: provide an authentication function

To support WL_bind_wayland_display an authentication function needs to be
provided but this was not being done for this platform as it's not strictly
necessary. However, as this isn't an optional function there's the potential
for a segfault to occur if authentication is mistakenly performed. Protect
against this by providing a function that prints an error.

Signed-off-by: Frank Binns <frank.binns at imgtec.com>
Reviewed-by: Axel Davy <axel.davy at ens.fr>

---

 src/egl/drivers/dri2/platform_x11_dri3.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c
index b781987..f996750 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -226,6 +226,23 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
    return NULL;
 }
 
+static int
+dri3_authenticate(_EGLDisplay *disp, uint32_t id)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+
+   if (dri2_dpy->device_name) {
+      _eglLog(_EGL_WARNING,
+              "Wayland client render node authentication is unnecessary");
+      return 0;
+   }
+
+   _eglLog(_EGL_WARNING,
+           "Wayland client primary node authentication isn't supported");
+
+   return -1;
+}
+
 /**
  * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
  */
@@ -419,7 +436,7 @@ dri3_get_dri_drawable(_EGLSurface *surf)
 }
 
 struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
-   .authenticate = NULL,
+   .authenticate = dri3_authenticate,
    .create_window_surface = dri3_create_window_surface,
    .create_pixmap_surface = dri3_create_pixmap_surface,
    .create_pbuffer_surface = dri3_create_pbuffer_surface,




More information about the mesa-commit mailing list