xserver: Branch 'xwayland' - 7 commits

Kristian Høgsberg krh at kemper.freedesktop.org
Fri Sep 6 15:32:03 PDT 2013


 configure.ac                          |   10 +++++--
 hw/xfree86/common/xf86AutoConfig.c    |    9 +++++--
 hw/xfree86/common/xf86Config.c        |   26 +++++++++++++++++---
 hw/xfree86/xwayland/Makefile.am       |    8 +++---
 hw/xfree86/xwayland/xwayland-drm.c    |   12 +++++++--
 hw/xfree86/xwayland/xwayland-output.c |    2 +
 hw/xfree86/xwayland/xwayland.c        |   43 ++++++++++++++++++++++++++--------
 7 files changed, 86 insertions(+), 24 deletions(-)

New commits:
commit ecc1ab56b1756bef5774ee7b617be1aeb8b3e347
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Aug 16 13:51:08 2013 +0100

    XWayland: Support 16bpp X surfaces in DRM/SHM
    
    Properly look at the window's visual to determine which format we should
    use for allocation.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c
index bfa0b74..428711b 100644
--- a/hw/xfree86/xwayland/xwayland-drm.c
+++ b/hw/xfree86/xwayland/xwayland-drm.c
@@ -225,10 +225,18 @@ xwl_create_window_buffer_drm(struct xwl_window *xwl_window,
 	if (screen->visuals[i].vid == visual)
 	    break;
 
-    if (screen->visuals[i].nplanes == 32)
+    switch (screen->visuals[i].nplanes) {
+    case 32:
 	format = WL_DRM_FORMAT_ARGB8888;
-    else
+        break;
+    case 24:
+    default:
 	format = WL_DRM_FORMAT_XRGB8888;
+        break;
+    case 16:
+        format = WL_DRM_FORMAT_RGB565;
+        break;
+    }
 
     xwl_window->buffer =
       wl_drm_create_buffer(xwl_window->xwl_screen->drm,
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index 6a515f5..36f7cbf 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -277,19 +277,43 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window,
 			     PixmapPtr pixmap, int fd)
 {
     struct wl_shm_pool *pool;
-    int size, stride;
+    WindowPtr window = xwl_window->window;
+    ScreenPtr screen = window->drawable.pScreen;
+    VisualID visual = wVisual(window);
+    uint32_t format;
+    int size, stride, bpp, i;
+
+    for (i = 0; i < screen->numVisuals; i++)
+        if (screen->visuals[i].vid == visual)
+            break;
+
+    switch (screen->visuals[i].nplanes) {
+    case 32:
+        format = WL_SHM_FORMAT_ARGB8888;
+        bpp = 4;
+        break;
+    case 24:
+    default:
+        format = WL_SHM_FORMAT_XRGB8888;
+        bpp = 4;
+        break;
+#ifdef WL_SHM_FORMAT_RGB565
+    case 16:
+        /* XXX: Check run-time protocol version too */
+        format = WL_SHM_FORMAT_RGB565;
+        bpp = 2;
+        break;
+#endif
+    }
 
-    stride = pixmap->drawable.width * 4;
+    stride = pixmap->drawable.width * bpp;
+    size = stride * pixmap->drawable.height;
 
-    size = pixmap->drawable.width * pixmap->drawable.height * 4;
     pool = wl_shm_create_pool(xwl_window->xwl_screen->shm, fd, size);
     xwl_window->buffer =  wl_shm_pool_create_buffer(pool, 0,
 			   pixmap->drawable.width,
 			   pixmap->drawable.height,
-			   stride,
-			   pixmap->drawable.depth == 32 ?
-			   WL_SHM_FORMAT_ARGB8888 :
-			   WL_SHM_FORMAT_XRGB8888);
+			   stride, format);
     wl_shm_pool_destroy(pool);
 
     return xwl_window->buffer ? Success : BadDrawable;
commit b60a1a56582d3de55effee9c6d981582da01b5b8
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Aug 16 13:20:39 2013 +0100

    XFree86: Only run Wayland code if building support
    
    i.e. hide xorgWayland usage behind #ifdef XORG_WAYLAND.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index c68b8db..ee19fc4 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -118,7 +118,9 @@ static ModuleDefault ModuleDefaults[] = {
     {.name = "fb",.toLoad = TRUE,.load_opt = NULL},
     {.name = "shadow",.toLoad = TRUE,.load_opt = NULL},
 #endif
+#ifdef XORG_WAYLAND
     {.name = "xwayland",.toLoad = FALSE,.load_opt=NULL},
+#endif
     {.name = NULL,.toLoad = FALSE,.load_opt=NULL}
 };
 
@@ -264,6 +266,7 @@ xf86ModulelistFromConfig(pointer **optlist)
     /*
      * Set the xwayland module to autoload if requested.
      */
+#ifdef XORG_WAYLAND
     if (xorgWayland) {
         for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
             if (strcmp(ModuleDefaults[i].name, "xwayland") == 0) {
@@ -271,7 +274,8 @@ xf86ModulelistFromConfig(pointer **optlist)
             }
         }
     }
-    
+#endif
+
     if (xf86configptr->conf_modules) {
         /* Walk the disable list and let people know what we've parsed to
          * not be loaded 
@@ -887,10 +891,12 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
             xf86Info.autoAddGPU ? "A" : "Not a");
 
     /* FIXME: Do that at the right place (before xf86Msg). */
+#ifdef XORG_WAYLAND
     if (xorgWayland) {
             xf86Info.autoAddDevices = FALSE;
             xf86Info.autoEnableDevices = FALSE;
     }
+#endif
 
     /*
      * Set things up based on the config file information.  Some of these
@@ -982,9 +988,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
     }
 #endif
 
+#ifdef XORG_WAYLAND
     if (xorgWayland) /* Don't force input devices */
 	xf86Info.forceInputDevices = FALSE;
     else /* if we're not hotplugging, force some input devices to exist */
+#endif
 	xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
 
     /* when forcing input devices, we use kbd. otherwise evdev, so use the
commit 697af5c237c8dc072f879f6644bc2563eb70e6aa
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Nov 7 17:15:13 2012 +1100

    XWayland: Don't hardcode DRM libs and -lwayland-client
    
    Take -lwayland-client from configure.ac, and only use DRM if we've
    actually asked for it.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/xwayland/Makefile.am b/hw/xfree86/xwayland/Makefile.am
index b739145..22ab154 100644
--- a/hw/xfree86/xwayland/Makefile.am
+++ b/hw/xfree86/xwayland/Makefile.am
@@ -7,13 +7,13 @@ AM_CPPFLAGS =					\
 	-I$(srcdir)/../modes
 
 libxwayland_la_LTLIBRARIES = libxwayland.la
-libxwayland_la_CFLAGS = \
+AM_CFLAGS = \
 	-DHAVE_XORG_CONFIG_H \
-	@DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@ \
+	@DIX_CFLAGS@ @XORG_CFLAGS@ @XWAYLAND_CFLAGS@ \
 	-I$(top_srcdir)/hw/xfree86/common \
 	-I$(top_srcdir)/hw/xfree86/os-support/bus
 
-libxwayland_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -lwayland-client
+libxwayland_la_LDFLAGS = -module -avoid-version @XWAYLAND_LIBS@
 libxwayland_ladir = $(moduledir)/extensions
 libxwayland_la_SOURCES =			\
 	xwayland.c				\
@@ -28,6 +28,8 @@ libxwayland_la_SOURCES =			\
 	xserver-protocol.c
 
 if DRM
+AM_CFLAGS += @LIBDRM_CFLAGS@
+libxwayland_la_LDFLAGS += @LIBDRM_LIBS@
 libxwayland_la_SOURCES += xwayland-drm.c
 endif
 
commit f4e2671ea756eacd3e357252d9edc7c6b46c7910
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Oct 16 17:14:01 2012 +1100

    xwayland: Introduce an auto mode for --enable-wayland
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/configure.ac b/configure.ac
index 81794da..752e60e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,7 +635,7 @@ AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin w
 AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
 AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
 AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
-AC_ARG_ENABLE(wayland,      AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: enabled)]), [WAYLAND=$enableval], [WAYLAND=yes])
+AC_ARG_ENABLE(wayland,      AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: auto)]), [WAYLAND=$enableval], [WAYLAND=auto])
 
 dnl DDXes.
 AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
@@ -1020,12 +1020,16 @@ if test "x$MITSHM" = xauto; then
 	MITSHM="$ac_cv_sysv_ipc"
 fi
 
-AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes])
+WAYLAND_MODULES="wayland-client libdrm"
+if test "x$WAYLAND" = xauto; then
+        PKG_CHECK_MODULES(XWAYLAND, $WAYLAND_MODULES, [WAYLAND=yes], [WAYLAND=no]) 
+fi
 if test "x$WAYLAND" = xyes; then
+        PKG_CHECK_MODULES(XWAYLAND, $WAYLAND_MODULES)
 	AC_DEFINE(XORG_WAYLAND, 1, [Support wayland mode])
-	REQUIRED_MODULES="$REQUIRED_MODULES wayland-client"
 	WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xfree86/xwayland'])
 fi
+AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes])
 
 AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
 if test "x$MITSHM" = xyes; then
commit 98802bf5e6191edb2cdf84b5f9c2f9e52a2626a5
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Nov 7 17:22:42 2012 +1100

    XWayland: Don't send out-of-bounds damage co-ordinates
    
    Make sure we don't send damage regions larger than the buffer.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index 2047a85..6a515f5 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -346,15 +346,14 @@ void xwl_screen_post_damage(struct xwl_screen *xwl_screen)
 
     xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
 			     link_damage) {
-
 	region = DamageRegion(xwl_window->damage);
 	count = RegionNumRects(region);
 	for (i = 0; i < count; i++) {
 	    box = &RegionRects(region)[i];
 	    wl_surface_damage(xwl_window->surface,
 			      box->x1, box->y1,
-			      box->x2 - box->x1 + 1,
-			      box->y2 - box->y1 + 1);
+			      box->x2 - box->x1,
+			      box->y2 - box->y1);
 	}
 	wl_surface_attach(xwl_window->surface,
 			  xwl_window->buffer,
commit 8e50e8975885806ec37871d5a22a3d65656a0aed
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Aug 16 13:21:21 2013 +0100

    XFree86: Load wlshm driver as fallback for Wayland
    
    Since fbdev or vesa are unlikely to be too useful there ...
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 95d58fe..d5a3370 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -283,10 +283,15 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 #if !defined(sun)
     /* Fallback to platform default frame buffer driver */
     if (i < (nmatches - 1)) {
+#ifdef XORG_WAYLAND
+        if (xorgWayland)
+            matches[i++] = xnfstrdup("wlshm");
+        else
+#endif
 #if !defined(__linux__) && defined(__sparc__)
-        matches[i++] = xnfstrdup("wsfb");
+            matches[i++] = xnfstrdup("wsfb");
 #else
-        matches[i++] = xnfstrdup("fbdev");
+            matches[i++] = xnfstrdup("fbdev");
 #endif
     }
 #endif                          /* !sun */
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 5b5cbac..c68b8db 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -519,7 +519,11 @@ xf86InputDriverlistFromConfig(void)
 static void
 fixup_video_driver_list(char **drivers)
 {
-    static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
+    static const char *fallback_hw[4] = { "vesa", "fbdev", "wsfb", NULL };
+#ifdef XORG_WAYLAND
+    static const char *fallback_wayland[2] = { "wlshm", NULL };
+#endif
+    const char **fallbacks;
     char **end, **drv;
     char *x;
     int i;
@@ -532,9 +536,15 @@ fixup_video_driver_list(char **drivers)
      * for each of the fallback drivers, if we find it in the list,
      * swap it with the last available non-fallback driver.
      */
-    for (i = 0; fallback[i]; i++) {
+#ifdef XORG_WAYLAND
+    if (xorgWayland)
+        fallbacks = fallback_wl;
+    else
+#endif
+        fallbacks = fallback_hw;
+    for (i = 0; fallbacks[i]; i++) {
         for (drv = drivers; drv != end; drv++) {
-            if (strstr(*drv, fallback[i])) {
+            if (strstr(*drv, fallbacks[i])) {
                 x = *drv;
                 *drv = *end;
                 *end = x;
commit e816565dfc1575e264076d2339531dd48b5ecd9b
Author: Jonas Ã…dahl <jadahl at gmail.com>
Date:   Sun Sep 1 23:14:43 2013 +0200

    xwayland: Probe outputs on preinit
    
    When running xwayland, calls to xf86SetDesiredModes() would fail due to
    the probed modes list not being populated. This was previously done
    indirectly by calling xf86InitialConfiguration() and now needs to be
    done explicitly instead.
    
    Signed-off-by: Jonas Ã…dahl <jadahl at gmail.com>

diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c
index 28003ba..53829c3 100644
--- a/hw/xfree86/xwayland/xwayland-output.c
+++ b/hw/xfree86/xwayland/xwayland-output.c
@@ -431,6 +431,8 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin
             FatalError("failed to dispatch Wayland events: %s\n", strerror(errno));
     }
 
+    xf86ProbeOutputModes(scrninfo, 0, 0);
+
     xwl_screen->outputs_initialized = TRUE;
 
     xf86SetScrnInfoModes(scrninfo);


More information about the xorg-commit mailing list