[RFC v3 2/3] xwayland: Add xwayland-config.h

Lyude Paul lyude at redhat.com
Fri Feb 9 21:41:09 UTC 2018


Just a small autogenerated header that will soon contain more then just
one macro.

Signed-off-by: Lyude Paul <lyude at redhat.com>
---
 configure.ac                       |  7 +++++++
 hw/xwayland/xwayland.c             | 10 ++++++----
 hw/xwayland/xwayland.h             |  2 +-
 include/meson.build                |  7 +++++++
 include/xwayland-config.h.in       | 10 ++++++++++
 include/xwayland-config.h.meson.in |  8 ++++++++
 6 files changed, 39 insertions(+), 5 deletions(-)
 create mode 100644 include/xwayland-config.h.in
 create mode 100644 include/xwayland-config.h.meson.in

diff --git a/configure.ac b/configure.ac
index 98b8ea2ed..e4c2965d6 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)
@@ -2373,6 +2375,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 979b72918..f4a9a0615 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -647,7 +647,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);
     else
@@ -725,7 +725,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);
@@ -909,7 +909,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
 
@@ -937,12 +937,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. */
@@ -1026,7 +1028,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 88e9ec832..7961cc6f1 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -26,7 +26,7 @@
 #ifndef XWAYLAND_H
 #define XWAYLAND_H
 
-#include <dix-config.h>
+#include <xwayland-config.h>
 
 #include <stdio.h>
 #include <unistd.h>
diff --git a/include/meson.build b/include/meson.build
index 00ec0573d..a5701fc53 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -293,6 +293,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 <dix-config.h>
+
+/* 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 <dix-config.h>
+
+/* Build glamor support for Xwayland */
+#mesondefine XWL_HAS_GLAMOR
-- 
2.14.3



More information about the xorg-devel mailing list