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

2018-04-24 Thread Daniel Stone
On 20 April 2018 at 19:38, Adam Jackson  wrote:
> Just a small autogenerated header that will soon contain more then just
> one macro.
>
> Signed-off-by: Lyude Paul 

Reviewed-by: Daniel Stone 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

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

2018-04-20 Thread Adam Jackson
From: Lyude Paul 

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

Signed-off-by: Lyude Paul 
---
 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 aa361d9a9a..b20eda12fb 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 b37b62c786..a5b3df7914 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, _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(>devPrivates, _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 82cbfc9d34..73f9c6a994 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 e454b21b9c..d44ec4b978 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 

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

2018-03-07 Thread Adam Jackson
From: Lyude Paul 

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

Signed-off-by: Lyude Paul 
---
 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, _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(>devPrivates, _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 
+#include 
 
 #include 
 #include 
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 0..333b53f23
--- /dev/null
+++ b/include/xwayland-config.h.in
@@ -0,0 +1,10 @@
+/* xwayland-config.h.in: not at all