Check for "platform_gbm" in the avaiable EGL extensions, and enable 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 <[email protected]> Signed-off-by: Olivier Fourdan <[email protected]> --- Note: * This was suggested by Ray Strode (halfline) in: https://gitlab.gnome.org/GNOME/mutter/issues/170 * This goes on top of the previous series here: https://patchwork.freedesktop.org/series/43704/ * If GBM is not supported and EGL stream wasn't enabled in Xwayland at build time, we even get a message from Xwayland stating that EGL streams backend is not enabled. hw/xwayland/xwayland-glamor.c | 7 +++++++ hw/xwayland/xwayland.c | 2 +- hw/xwayland/xwayland.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index f543f321d..b84c78735 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -58,6 +58,13 @@ 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 !!strstr((char *)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS), + "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 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
