diff --git a/configure.ac b/configure.ac index aa361d9a9..b20eda12f 100644 --- a/configure.ac +++ b/configure.ac @@ -67,6 +67,8 @@ dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs. AC_CONFIG_HEADERS(include/xkb-config.h) dnl xwin-config.h covers the XWin DDX. AC_CONFIG_HEADERS(include/xwin-config.h) +dnl xwayland-config.h covers Xwayland. +AC_CONFIG_HEADERS(include/xwayland-config.h) dnl version-config.h covers the version numbers so they can be bumped without dnl forcing an entire recompile.x AC_CONFIG_HEADERS(include/version-config.h) @@ -2378,6 +2380,11 @@ if test "x$XWAYLAND" = xyes; then AC_MSG_ERROR([Xwayland build explicitly requested, but required modules not found.]) fi + if test "x$GLAMOR" = xyes && test "x$GBM" = xyes; then + AC_DEFINE(XWL_HAS_GLAMOR, 1, + [Build xwayland with glamor support]) + fi + XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB" XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XWAYLAND_LIBS]) diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index b37b62c78..a5b3df791 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -668,7 +668,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window) region = DamageRegion(xwl_window->damage); pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window); -#ifdef GLAMOR_HAS_GBM +#ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, pixmap->drawable.width, @@ -754,7 +754,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1); xwl_screen_init_xdg_output(xwl_screen); } -#ifdef GLAMOR_HAS_GBM +#ifdef XWL_HAS_GLAMOR else if (xwl_screen->glamor) { xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface, version); @@ -938,7 +938,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen); xwl_screen->screen = pScreen; -#ifdef GLAMOR_HAS_GBM +#ifdef XWL_HAS_GLAMOR xwl_screen->glamor = 1; #endif @@ -966,12 +966,14 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) } } +#ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) { if (!xwl_glamor_init_gbm(xwl_screen)) { ErrorF("xwayland glamor: failed to setup GBM backend, falling back to sw accel\n"); xwl_screen->glamor = 0; } } +#endif /* In rootless mode, we don't have any screen storage, and the only * rendering should be to redirected mode. */ @@ -1055,7 +1057,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) if (!xwl_screen_init_cursor(xwl_screen)) return FALSE; -#ifdef GLAMOR_HAS_GBM +#ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) { ErrorF("Failed to initialize glamor, falling back to sw\n"); xwl_screen->glamor = 0; diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h index 82cbfc9d3..73f9c6a99 100644 --- a/hw/xwayland/xwayland.h +++ b/hw/xwayland/xwayland.h @@ -26,7 +26,7 @@ #ifndef XWAYLAND_H #define XWAYLAND_H -#include +#include #include #include diff --git a/include/meson.build b/include/meson.build index e454b21b9..d44ec4b97 100644 --- a/include/meson.build +++ b/include/meson.build @@ -359,6 +359,13 @@ configure_file(output : 'xwin-config.h', input : 'xwin-config.h.meson.in', configuration : xwin_data) +xwayland_data = configuration_data() +xwayland_data.set('XWL_HAS_GLAMOR', build_glamor and gbm_dep.found()) + +configure_file(output : 'xwayland-config.h', + input : 'xwayland-config.h.meson.in', + configuration : xwayland_data) + if build_xorg install_data( [ diff --git a/include/xwayland-config.h.in b/include/xwayland-config.h.in new file mode 100644 index 000000000..333b53f23 --- /dev/null +++ b/include/xwayland-config.h.in @@ -0,0 +1,10 @@ +/* xwayland-config.h.in: not at all generated. */ +#ifndef _XWAYLAND_CONFIG_H_ +#define _XWAYLAND_CONFIG_H_ + +#include + +/* Build glamor support for Xwayland */ +#undef XWL_HAS_GLAMOR + +#endif /* _XWAYLAND_CONFIG_H_ */ diff --git a/include/xwayland-config.h.meson.in b/include/xwayland-config.h.meson.in new file mode 100644 index 000000000..6d37e8bf6 --- /dev/null +++ b/include/xwayland-config.h.meson.in @@ -0,0 +1,8 @@ +/* xwayland-config.h.meson.in: not at all generated */ + +#pragma once + +#include + +/* Build glamor support for Xwayland */ +#mesondefine XWL_HAS_GLAMOR