[Mesa-dev] [PATCH 03/12] egl/x11: require DRI2 1.3 or later

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 3 18:29:29 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

Introduced back in 2010 with dri2proto v2.3 and Xserver 1.9

A look through the drivers indicate that only xf86-video-ati running
a kernel older than 2.6.35 or xf86-video-freedreno using kgsl (does it
work with EGL to begin with?) may be hitting this old codepath.

Other drivers, such as omap, armsoc, vmwgfx drivers explicitly require
DRI2INFOREC_VERSION 4 or later, which maps to DRI2 1.3 in the Xserver
code.

Even Debian oldoldstable ships newer version of said components -
xserver 1.12 and dri2proto 2.6.

Reject connection to such ancient servers and drop the now dead code -
dri2_loader_extension{,s}_old.

Cc: Rob Clark <robdclark at gmail.com
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Rob, can you check the kgsl question?
---
 src/egl/drivers/dri2/egl_dri2.h     |  2 --
 src/egl/drivers/dri2/platform_x11.c | 29 +++++------------------------
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index ccfefef61fc..23f1ca6a641 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -160,8 +160,6 @@ struct dri2_egl_display
 {
    const struct dri2_egl_display_vtbl *vtbl;
 
-   int                       dri2_major;
-   int                       dri2_minor;
    __DRIscreen              *dri_screen;
    bool                      own_dri_screen;
    const __DRIconfig       **driver_configs;
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 43b218ec486..9d30903659d 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -652,13 +652,12 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
 
    dri2_query =
       xcb_dri2_query_version_reply (dri2_dpy->conn, dri2_query_cookie, &error);
-   if (dri2_query == NULL || error != NULL) {
+   if (dri2_query == NULL || error != NULL || dri2_query->minor_version < 3) {
       _eglLog(_EGL_WARNING, "DRI2: failed to query version");
       free(error);
+      free(dri2_query);
       return EGL_FALSE;
    }
-   dri2_dpy->dri2_major = dri2_query->major_version;
-   dri2_dpy->dri2_minor = dri2_query->minor_version;
    free(dri2_query);
 
    connect = xcb_dri2_connect_reply (dri2_dpy->conn, connect_cookie, NULL);
@@ -1382,14 +1381,6 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
 }
 #endif
 
-static const __DRIdri2LoaderExtension dri2_loader_extension_old = {
-   .base = { __DRI_DRI2_LOADER, 2 },
-
-   .getBuffers           = dri2_x11_get_buffers,
-   .flushFrontBuffer     = dri2_x11_flush_front_buffer,
-   .getBuffersWithFormat = NULL,
-};
-
 static const __DRIdri2LoaderExtension dri2_loader_extension = {
    .base = { __DRI_DRI2_LOADER, 3 },
 
@@ -1398,13 +1389,6 @@ static const __DRIdri2LoaderExtension dri2_loader_extension = {
    .getBuffersWithFormat = dri2_x11_get_buffers_with_format,
 };
 
-static const __DRIextension *dri2_loader_extensions_old[] = {
-   &dri2_loader_extension_old.base,
-   &image_lookup_extension.base,
-   &background_callable_extension.base,
-   NULL,
-};
-
 static const __DRIextension *dri2_loader_extensions[] = {
    &dri2_loader_extension.base,
    &image_lookup_extension.base,
@@ -1432,13 +1416,10 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
    if (!dri2_load_driver(disp))
       goto cleanup;
 
-   if (dri2_dpy->dri2_minor >= 1)
-      dri2_dpy->loader_extensions = dri2_loader_extensions;
-   else
-      dri2_dpy->loader_extensions = dri2_loader_extensions_old;
+   dri2_dpy->loader_extensions = dri2_loader_extensions;
 
-   dri2_dpy->swap_available = (dri2_dpy->dri2_minor >= 2);
-   dri2_dpy->invalidate_available = (dri2_dpy->dri2_minor >= 3);
+   dri2_dpy->swap_available = true;
+   dri2_dpy->invalidate_available = true;
 
    if (!dri2_create_screen(disp))
       goto cleanup;
-- 
2.13.3



More information about the mesa-dev mailing list