[PATCH xserver 2/3] xwayland: Add xwayland-config.h

Adam Jackson ajax at redhat.com
Wed Mar 7 19:18:55 UTC 2018


From: Lyude Paul <lyude at redhat.com>

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 f82c0a66a..e8dba70d8 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)
@@ -2383,6 +2385,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 8b8fbc1aa..941127cf0 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
 #if 0
     else if (xwl_screen->glamor &&
              strcmp(interface, "wl_drm") == 0 && version >= 2) {
@@ -919,7 +919,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
 
@@ -947,12 +947,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. */
@@ -1036,7 +1038,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 64c504373..bf29f31e1 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 e6abf22f8..19acdca4f 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -306,6 +306,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.16.2



More information about the xorg-devel mailing list