[PATCH v2 xserver] Xwayland: Enable EGL backend automatically

Olivier Fourdan ofourdan at redhat.com
Wed May 30 09:19:52 UTC 2018


Check for "EGL_MESA_platform_gbm" in the avaiable EGL extensions, and
try automatically EGL stream if not present.

The command line options “-eglstream” is kept for compatibility to force
the use of the EGL streams backend.

Suggested-by: Ray Strode <rstrode at redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 v2: Use epoxy_has_egl_extension() instead of strstr() which is error prone
     as poitned out by Pekka.

 hw/xwayland/xwayland-glamor.c | 6 ++++++
 hw/xwayland/xwayland.c        | 2 +-
 hw/xwayland/xwayland.h        | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index f543f321d..6ae274c08 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -58,6 +58,12 @@ xwl_glamor_egl_supports_device_probing(void)
     return epoxy_has_egl_extension(NULL, "EGL_EXT_device_base");
 }
 
+Bool
+xwl_glamor_should_use_gbm(void)
+{
+    return epoxy_has_egl_extension(NULL, "EGL_MESA_platform_gbm");
+}
+
 void **
 xwl_glamor_egl_get_devices(int *num_devices)
 {
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index a08d58451..4dd8f3810 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -939,7 +939,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     struct xwl_screen *xwl_screen;
     Pixel red_mask, blue_mask, green_mask;
     int ret, bpc, green_bpc, i;
-    Bool use_eglstreams = FALSE;
+    Bool use_eglstreams = !xwl_glamor_should_use_gbm();
 
     xwl_screen = calloc(1, sizeof *xwl_screen);
     if (xwl_screen == NULL)
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 39bc20a7e..ff746114c 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -444,6 +444,7 @@ void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
 
 void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
 Bool xwl_glamor_egl_supports_device_probing(void);
+Bool xwl_glamor_should_use_gbm(void);
 void **xwl_glamor_egl_get_devices(int *num_devices);
 Bool xwl_glamor_egl_device_has_egl_extensions(void *device,
                                               const char **ext_list,
-- 
2.17.0



More information about the xorg-devel mailing list