xserver: Branch 'server-1.17-branch' - 58 commits

Adam Jackson ajax at kemper.freedesktop.org
Tue Jun 16 09:25:00 PDT 2015


 Xext/shm.c                                       |   10 +-
 configure.ac                                     |   10 +-
 dix/devices.c                                    |    3 
 dix/events.c                                     |    1 
 glamor/glamor.c                                  |   40 ++++++++
 glamor/glamor_core.c                             |    2 
 glamor/glamor_egl.c                              |    6 +
 glamor/glamor_fbo.c                              |    1 
 glamor/glamor_font.c                             |    1 
 glamor/glamor_largepixmap.c                      |    9 +
 glamor/glamor_pixmap.c                           |    1 
 glamor/glamor_priv.h                             |    6 +
 glamor/glamor_program.c                          |    3 
 glamor/glamor_render.c                           |   10 +-
 glamor/glamor_spans.c                            |    2 
 glamor/glamor_sync.c                             |    2 
 glamor/glamor_transfer.c                         |   57 +++++++----
 hw/kdrive/ephyr/ephyrinit.c                      |   11 +-
 hw/kdrive/ephyr/hostx.c                          |   27 +++--
 hw/kdrive/fake/Makefile.am                       |    1 
 hw/kdrive/fbdev/Makefile.am                      |    1 
 hw/xfree86/common/xf86Events.c                   |    7 -
 hw/xfree86/common/xf86platformBus.c              |   20 +++-
 hw/xfree86/drivers/modesetting/drmmode_display.c |    4 
 hw/xfree86/drivers/modesetting/dumb_bo.c         |    4 
 hw/xfree86/int10/generic.c                       |    2 
 hw/xfree86/modes/xf86Crtc.h                      |    2 
 hw/xfree86/os-support/linux/int10/linux.c        |    2 
 hw/xfree86/os-support/linux/systemd-logind.c     |   17 +--
 hw/xfree86/sdksyms.sh                            |   14 ++
 hw/xnest/Keyboard.c                              |    4 
 hw/xwayland/Makefile.am                          |    1 
 hw/xwayland/xwayland-cursor.c                    |   26 +++++
 hw/xwayland/xwayland-glamor.c                    |    4 
 hw/xwayland/xwayland-input.c                     |   57 +++--------
 hw/xwayland/xwayland-output.c                    |    4 
 hw/xwayland/xwayland.c                           |    4 
 hw/xwayland/xwayland.h                           |    8 -
 hw/xwin/glx/gen_gl_wrappers.py                   |   96 +++++++++----------
 hw/xwin/winclipboard/Makefile.am                 |    2 
 hw/xwin/winprocarg.c                             |   14 ++
 include/dix-config.h.in                          |    6 +
 include/input.h                                  |    2 
 include/os.h                                     |   17 +++
 include/servermd.h                               |    2 
 mi/mifillarc.c                                   |    5 +
 os/access.c                                      |  111 ++++++++++++++++++++++-
 os/auth.c                                        |    8 -
 os/backtrace.c                                   |    4 
 os/connection.c                                  |    9 +
 os/log.c                                         |   28 ++++-
 os/utils.c                                       |    2 
 os/xdmcp.c                                       |   21 ++++
 present/present.c                                |    8 -
 randr/rrcrtc.c                                   |    6 -
 randr/rrscreen.c                                 |    2 
 56 files changed, 535 insertions(+), 192 deletions(-)

New commits:
commit 2123f7682d522619f101b05fb75efa75dabbe371
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 16 11:42:47 2015 -0400

    xserver 1.17.2
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/configure.ac b/configure.ac
index 847b5c4..d8f0e74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.17.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2015-02-10"
+AC_INIT([xorg-server], 1.17.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2015-06-16"
 RELEASE_NAME="lambic"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
commit 8a5fb096d43577a061f7769d9257cbedaac998ef
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu May 28 05:30:01 2015 +0000

    glamor: don't do render ops with matching source/dest (v2)
    
    XRender defines this, GL really doesn't like it.
    
    kwin 4.x and qt 4.x seem to make this happen for the
    gradient in the titlebar, and on radeonsi/r600 hw
    this draws all kinds of wrong.
    
    v2: bump this up a level, and check it earlier.
    (I assume the XXXX was for this case.)
    
    [This corresponds to fa12f2c150b2f50de9dac4a2b09265f13af353af in master,
    fixed up for 1.17 branch. - ajax]
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
index 9b24584..b9c3b9a 100644
--- a/glamor/glamor_largepixmap.c
+++ b/glamor/glamor_largepixmap.c
@@ -1046,6 +1046,15 @@ glamor_composite_largepixmap_region(CARD8 op,
     int source_repeat_type = 0, mask_repeat_type = 0;
     int ok = TRUE;
 
+    if (source_pixmap_priv == dest_pixmap_priv) {
+        glamor_fallback("source and dest pixmaps are the same\n");
+        return FALSE;
+    }
+    if (mask_pixmap_priv ==  dest_pixmap_priv) {
+        glamor_fallback("mask and dest pixmaps are the same\n");
+        return FALSE;
+    }
+
     if (source->repeat)
         source_repeat_type = source->repeatType;
     else
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 2386f2e..d9b16ea 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1400,6 +1400,7 @@ glamor_composite_clipped_region(CARD8 op,
 {
     ScreenPtr screen = dest->pDrawable->pScreen;
     PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
+    PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
     PicturePtr temp_src = source, temp_mask = mask;
     glamor_pixmap_private *temp_src_priv = source_pixmap_priv;
     glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv;
@@ -1502,7 +1503,14 @@ glamor_composite_clipped_region(CARD8 op,
         }
     }
 
-    /*XXXXX, self copy? */
+    if (source_pixmap == dest_pixmap) {
+        glamor_fallback("source and dest pixmaps are the same\n");
+        goto out;
+    }
+    if (mask_pixmap == dest_pixmap) {
+        glamor_fallback("mask and dest pixmaps are the same\n");
+        goto out;
+    }
 
     x_dest += dest->pDrawable->x;
     y_dest += dest->pDrawable->y;
commit ea9e02184399e9979654544dde8926912a8aa2c8
Author: Rui Matos <tiagomatos at gmail.com>
Date:   Wed May 27 12:08:45 2015 +0200

    xwayland: Throttle our cursor surface updates with a frame callback
    
    In some extreme cases with animated cursors at a high frame rate we
    could end up filling the wl_display outgoing buffer and end up with
    wl_display_flush() failing.
    
    In any case, using the frame callback to throttle ourselves is the
    right thing to do.
    
    Signed-off-by: Rui Matos <tiagomatos at gmail.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit cbb7eb73b5399e31a7afb800363504d539df0ecf)

diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 5a9d1fe..c137e1e 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -82,6 +82,23 @@ xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
     return xwl_shm_destroy_pixmap(pixmap);
 }
 
+static void
+frame_callback(void *data,
+               struct wl_callback *callback,
+               uint32_t time)
+{
+    struct xwl_seat *xwl_seat = data;
+    xwl_seat->cursor_frame_cb = NULL;
+    if (xwl_seat->cursor_needs_update) {
+        xwl_seat->cursor_needs_update = FALSE;
+        xwl_seat_set_cursor(xwl_seat);
+    }
+}
+
+static const struct wl_callback_listener frame_listener = {
+    frame_callback
+};
+
 void
 xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
 {
@@ -98,6 +115,11 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
         return;
     }
 
+    if (xwl_seat->cursor_frame_cb) {
+        xwl_seat->cursor_needs_update = TRUE;
+        return;
+    }
+
     cursor = xwl_seat->x_cursor;
     pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
     stride = cursor->bits->width * 4;
@@ -117,6 +139,10 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
     wl_surface_damage(xwl_seat->cursor, 0, 0,
                       xwl_seat->x_cursor->bits->width,
                       xwl_seat->x_cursor->bits->height);
+
+    xwl_seat->cursor_frame_cb = wl_surface_frame(xwl_seat->cursor);
+    wl_callback_add_listener(xwl_seat->cursor_frame_cb, &frame_listener, xwl_seat);
+
     wl_surface_commit(xwl_seat->cursor);
 }
 
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index cbffea7..4639048 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -569,6 +569,8 @@ xwl_seat_destroy(struct xwl_seat *xwl_seat)
     RemoveDevice(xwl_seat->keyboard, FALSE);
     wl_seat_destroy(xwl_seat->seat);
     wl_surface_destroy(xwl_seat->cursor);
+    if (xwl_seat->cursor_frame_cb)
+        wl_callback_destroy(xwl_seat->cursor_frame_cb);
     wl_array_release(&xwl_seat->keys);
     free(xwl_seat);
 }
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index cfb343d..28b0c99 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -115,12 +115,14 @@ struct xwl_seat {
     struct wl_pointer *wl_pointer;
     struct wl_keyboard *wl_keyboard;
     struct wl_array keys;
-    struct wl_surface *cursor;
     struct xwl_window *focus_window;
     uint32_t id;
     uint32_t pointer_enter_serial;
     struct xorg_list link;
     CursorPtr x_cursor;
+    struct wl_surface *cursor;
+    struct wl_callback *cursor_frame_cb;
+    Bool cursor_needs_update;
 
     size_t keymap_size;
     char *keymap;
commit 6cc61df989c7764097c9b21d71386e230fa13cd4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 6 08:25:42 2015 +0000

    present: Copy unflip contents back to the Screen Pixmap
    
    As we unflip after the flip Window no longer passes the pixel ownership
    test for the full Screen Pixmap, we can no longer utilize that Window to
    copy the contents back to the backing pixmap. To first flip means that
    the Window was originally backed by the Screen Pixmap and wholly covered
    the Pixmap, thus we need to copy the last frame contents to the Screen
    Pixmap when the flip chain is complete.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer at amd.com>
    (cherry picked from commit 806470b9f623089dc81b985f250f0c3a4e8edbe8)

diff --git a/present/present.c b/present/present.c
index 2a705a9..a634601 100644
--- a/present/present.c
+++ b/present/present.c
@@ -409,20 +409,20 @@ static void
 present_unflip(ScreenPtr screen)
 {
     present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+    PixmapPtr pixmap = (*screen->GetScreenPixmap)(screen);
 
     assert (!screen_priv->unflip_event_id);
     assert (!screen_priv->flip_pending);
 
     if (screen_priv->flip_window)
-        present_set_tree_pixmap(screen_priv->flip_window,
-                                  (*screen->GetScreenPixmap)(screen));
+        present_set_tree_pixmap(screen_priv->flip_window, pixmap);
 
-    present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
+    present_set_tree_pixmap(screen->root, pixmap);
 
     /* Update the screen pixmap with the current flip pixmap contents
      */
     if (screen_priv->flip_pixmap && screen_priv->flip_window) {
-        present_copy_region(&screen_priv->flip_window->drawable,
+        present_copy_region(&pixmap->drawable,
                             screen_priv->flip_pixmap,
                             NULL, 0, 0);
     }
commit 8b7e1f362bf6940eb863fd02395bf8155d10604b
Author: Vicente Olivert Riera <Vincent.Riera at imgtec.com>
Date:   Mon Jan 12 17:10:02 2015 +0000

    backtrace.c: Fix word cast to a pointer
    
    backtrace.c uses a word size provided by libunwind. In some
    architectures like MIPS, libunwind makes that word size 64-bit for all
    variants of the architecture.
    
    In the lines #90 and #98, backtrace.c tries to do a cast to a pointer,
    which fails in all MIPS variants with 32-bit pointers, like MIPS32 or
    MIPS64 n32, because it's trying to do a cast from a 64-bit wide variable
    to a 32-bit pointer:
    
    Making all in os
    make[2]: Entering directory
    `/home/test/test/1/output/build/xserver_xorg-server-1.15.1/os'
      CC     WaitFor.lo
      CC     access.lo
      CC     auth.lo
      CC     backtrace.lo
    backtrace.c: In function 'xorg_backtrace':
    backtrace.c:90:20: error: cast to pointer from integer of different size
    [-Werror=int-to-pointer-cast]
    	 if (dladdr((void *)(pip.start_ip + off), &dlinfo) &&
    dlinfo.dli_fname &&
    		    ^
    backtrace.c:98:13: error: cast to pointer from integer of different size
    [-Werror=int-to-pointer-cast]
    	     (void *)(pip.start_ip + off));
    	     ^
    cc1: some warnings being treated as errors
    make[2]: *** [backtrace.lo] Error 1
    make[2]: *** Waiting for unfinished jobs....
    
    Making the cast to a pointer-sized integer, and then to a pointer fixes
    the problem.
    
    Related:
      https://bugs.freedesktop.org/show_bug.cgi?id=79939
    
    Signed-off-by: Vicente Olivert Riera <Vincent.Riera at imgtec.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit baa50f60acd9e9f4293107435645ab072b6110e1)

diff --git a/os/backtrace.c b/os/backtrace.c
index 3d1195b..fd129ef 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -87,7 +87,7 @@ xorg_backtrace(void)
             procname[1] = 0;
         }
 
-        if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
+        if (dladdr((void *)(uintptr_t)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
                 *dlinfo.dli_fname)
             filename = dlinfo.dli_fname;
         else
@@ -95,7 +95,7 @@ xorg_backtrace(void)
 
         ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
             ret == -UNW_ENOMEM ? "..." : "", (int)off,
-            (void *)(pip.start_ip + off));
+            (void *)(uintptr_t)(pip.start_ip + off));
 
         ret = unw_step(&cursor);
         if (ret < 0)
commit c424458c93cb36708c6074ecaf6566d6b5818c87
Author: Ray Strode <rstrode at redhat.com>
Date:   Tue May 5 16:43:44 2015 -0400

    xwayland: default to local user if no xauth file given. [CVE-2015-3164 3/3]
    
    Right now if "-auth" isn't passed on the command line, we let
    any user on the system connect to the Xwayland server.
    
    That's clearly suboptimal, given Xwayland is generally designed
    to be used by one user at a time.
    
    This commit changes the behavior, so only the user who started the
    X server can connect clients to it.
    
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 76636ac12f2d1dbdf7be08222f80e7505d53c451)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c5bee77..bc92beb 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -702,4 +702,6 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
     if (AddScreen(xwl_screen_init, argc, argv) == -1) {
         FatalError("Couldn't add screen\n");
     }
+
+    LocalAccessScopeUser();
 }
commit 01b4f5bc89820cf8cbe01777871834411074d683
Author: Ray Strode <rstrode at redhat.com>
Date:   Tue May 5 16:43:43 2015 -0400

    os: support new implicit local user access mode [CVE-2015-3164 2/3]
    
    If the X server is started without a '-auth' argument, then
    it gets started wide open to all local users on the system.
    
    This isn't a great default access model, but changing it in
    Xorg at this point would break backward compatibility.
    
    Xwayland, on the other hand is new, and much more targeted
    in scope.  It could, in theory, be changed to allow the much
    more secure default of a "user who started X server can connect
    clients to that server."
    
    This commit paves the way for that change, by adding a mechanism
    for DDXs to opt-in to that behavior.  They merely need to call
    
    LocalAccessScopeUser()
    
    in their init functions.
    
    A subsequent commit will add that call for Xwayland.
    
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4b4b9086d02b80549981d205fb1f495edc373538)

diff --git a/include/os.h b/include/os.h
index 3e68c49..3c3954f 100644
--- a/include/os.h
+++ b/include/os.h
@@ -413,11 +413,28 @@ extern _X_EXPORT void
 ResetHosts(const char *display);
 
 extern _X_EXPORT void
+EnableLocalAccess(void);
+
+extern _X_EXPORT void
+DisableLocalAccess(void);
+
+extern _X_EXPORT void
 EnableLocalHost(void);
 
 extern _X_EXPORT void
 DisableLocalHost(void);
 
+#ifndef NO_LOCAL_CLIENT_CRED
+extern _X_EXPORT void
+EnableLocalUser(void);
+
+extern _X_EXPORT void
+DisableLocalUser(void);
+
+extern _X_EXPORT void
+LocalAccessScopeUser(void);
+#endif
+
 extern _X_EXPORT void
 AccessUsingXdmcp(void);
 
diff --git a/os/access.c b/os/access.c
index 8fa028e..75e7a69 100644
--- a/os/access.c
+++ b/os/access.c
@@ -102,6 +102,10 @@ SOFTWARE.
 #include <sys/ioctl.h>
 #include <ctype.h>
 
+#ifndef NO_LOCAL_CLIENT_CRED
+#include <pwd.h>
+#endif
+
 #if defined(TCPCONN) || defined(STREAMSCONN)
 #include <netinet/in.h>
 #endif                          /* TCPCONN || STREAMSCONN */
@@ -225,6 +229,13 @@ static int LocalHostEnabled = FALSE;
 static int LocalHostRequested = FALSE;
 static int UsingXdmcp = FALSE;
 
+static enum {
+    LOCAL_ACCESS_SCOPE_HOST = 0,
+#ifndef NO_LOCAL_CLIENT_CRED
+    LOCAL_ACCESS_SCOPE_USER,
+#endif
+} LocalAccessScope;
+
 /* FamilyServerInterpreted implementation */
 static Bool siAddrMatch(int family, void *addr, int len, HOST * host,
                         ClientPtr client);
@@ -237,6 +248,21 @@ static void siTypesInitialize(void);
  */
 
 void
+EnableLocalAccess(void)
+{
+    switch (LocalAccessScope) {
+        case LOCAL_ACCESS_SCOPE_HOST:
+            EnableLocalHost();
+            break;
+#ifndef NO_LOCAL_CLIENT_CRED
+        case LOCAL_ACCESS_SCOPE_USER:
+            EnableLocalUser();
+            break;
+#endif
+    }
+}
+
+void
 EnableLocalHost(void)
 {
     if (!UsingXdmcp) {
@@ -249,6 +275,21 @@ EnableLocalHost(void)
  * called when authorization is enabled to keep us secure
  */
 void
+DisableLocalAccess(void)
+{
+    switch (LocalAccessScope) {
+        case LOCAL_ACCESS_SCOPE_HOST:
+            DisableLocalHost();
+            break;
+#ifndef NO_LOCAL_CLIENT_CRED
+        case LOCAL_ACCESS_SCOPE_USER:
+            DisableLocalUser();
+            break;
+#endif
+    }
+}
+
+void
 DisableLocalHost(void)
 {
     HOST *self;
@@ -262,6 +303,74 @@ DisableLocalHost(void)
     }
 }
 
+#ifndef NO_LOCAL_CLIENT_CRED
+static int GetLocalUserAddr(char **addr)
+{
+    static const char *type = "localuser";
+    static const char delimiter = '\0';
+    static const char *value;
+    struct passwd *pw;
+    int length = -1;
+
+    pw = getpwuid(getuid());
+
+    if (pw == NULL || pw->pw_name == NULL)
+        goto out;
+
+    value = pw->pw_name;
+
+    length = asprintf(addr, "%s%c%s", type, delimiter, value);
+
+    if (length == -1) {
+        goto out;
+    }
+
+    /* Trailing NUL */
+    length++;
+
+out:
+    return length;
+}
+
+void
+EnableLocalUser(void)
+{
+    char *addr = NULL;
+    int length = -1;
+
+    length = GetLocalUserAddr(&addr);
+
+    if (length == -1)
+        return;
+
+    NewHost(FamilyServerInterpreted, addr, length, TRUE);
+
+    free(addr);
+}
+
+void
+DisableLocalUser(void)
+{
+    char *addr = NULL;
+    int length = -1;
+
+    length = GetLocalUserAddr(&addr);
+
+    if (length == -1)
+        return;
+
+    RemoveHost(NULL, FamilyServerInterpreted, length, addr);
+
+    free(addr);
+}
+
+void
+LocalAccessScopeUser(void)
+{
+    LocalAccessScope = LOCAL_ACCESS_SCOPE_USER;
+}
+#endif
+
 /*
  * called at init time when XDMCP will be used; xdmcp always
  * adds local hosts manually when needed
diff --git a/os/auth.c b/os/auth.c
index 5fcb538..7da6fc6 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -181,11 +181,11 @@ CheckAuthorization(unsigned int name_length,
 
         /*
          * If the authorization file has at least one entry for this server,
-         * disable local host access. (loadauth > 0)
+         * disable local access. (loadauth > 0)
          *
          * If there are zero entries (either initially or when the
          * authorization file is later reloaded), or if a valid
-         * authorization file was never loaded, enable local host access.
+         * authorization file was never loaded, enable local access.
          * (loadauth == 0 || !loaded)
          *
          * If the authorization file was loaded initially (with valid
@@ -194,11 +194,11 @@ CheckAuthorization(unsigned int name_length,
          */
 
         if (loadauth > 0) {
-            DisableLocalHost(); /* got at least one */
+            DisableLocalAccess(); /* got at least one */
             loaded = TRUE;
         }
         else if (loadauth == 0 || !loaded)
-            EnableLocalHost();
+            EnableLocalAccess();
     }
     if (name_length) {
         for (i = 0; i < NUM_AUTHORIZATION; i++) {
commit bebaaa2216026bd6b649a8123e67a7f5172b120f
Author: Ray Strode <rstrode at redhat.com>
Date:   Tue May 5 16:43:42 2015 -0400

    xwayland: Enable access control on open sockets [CVE-2015-3164 1/3]
    
    Xwayland currently allows wide-open access to the X sockets
    it listens on, ignoring Xauth access control.
    
    This commit makes sure to enable access control on the sockets,
    so one user can't snoop on another user's X-over-wayland
    applications.
    
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit c4534a38b68aa07fb82318040dc8154fb48a9588)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 7e8d667..c5bee77 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -483,7 +483,7 @@ listen_on_fds(struct xwl_screen *xwl_screen)
     int i;
 
     for (i = 0; i < xwl_screen->listen_fd_count; i++)
-        ListenOnOpenFD(xwl_screen->listen_fds[i], TRUE);
+        ListenOnOpenFD(xwl_screen->listen_fds[i], FALSE);
 }
 
 static void
commit 761be9cceb6f5a2ca883c940d6e1f277ce529ea8
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue May 12 09:52:48 2015 -0700

    Xephyr: Fix broken image when endianess of client machine and host-Xserver differ
    
    The image is created in the native byte order of the machine Xephyr is
    rendered on however drawn in the image byte order of the Xephyr server.
    Correct byte order in the xcb_image_t structure and convert to native
    before updating the window.
    If depths of Xephyr and host server differ this is already taken care of
    by the depth conversion routine.
    It is a terrible wase to always convert and transmit the entire image
    no matter of the size of the damaged area. One should probably use
    sub-images here. For now we leave this as an exercise.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 910ddf85219f114744e8996a4ac044c4eafc62ac)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 2279315..71c1691 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -866,6 +866,11 @@ hostx_screen_init(KdScreenInfo *screen,
                                                     ~0,
                                                     NULL);
 
+        /* Match server byte order so that the image can be converted to
+         * the native byte order by xcb_image_put() before drawing */
+        if (host_depth_matches_server(scrpriv))
+            scrpriv->ximg->byte_order = IMAGE_BYTE_ORDER;
+
         scrpriv->ximg->data =
             malloc(scrpriv->ximg->stride * buffer_height);
     }
@@ -1034,8 +1039,11 @@ hostx_paint_rect(KdScreenInfo *screen,
                           sx, sy, dx, dy, width, height, FALSE);
     }
     else {
-        xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, scrpriv->ximg,
-                      0, 0, 0);
+        /* This is slow and could be done better */
+        xcb_image_t *img = xcb_image_native (HostX.conn, scrpriv->ximg, 1);
+        xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, img, 0, 0, 0);
+        if (scrpriv->ximg != img)
+            xcb_image_destroy(img);
     }
 
     xcb_aux_sync(HostX.conn);
commit f775f247731d368c76d9bda3672fbdda7ba21223
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue Mar 31 09:14:28 2015 +0200

    Xephyr: Fix screen image draw for the non-Glamor & non-XHSM case
    
    xcb_image_put() prints the entire image, therefore don't use an offset.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit c65eda5e6676d942e80eaf2650a670174c8bd84a)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 992930d..2279315 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1035,7 +1035,7 @@ hostx_paint_rect(KdScreenInfo *screen,
     }
     else {
         xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, scrpriv->ximg,
-                      dx, dy, 0);
+                      0, 0, 0);
     }
 
     xcb_aux_sync(HostX.conn);
commit 6395873ea9a9ccc4ddb840e295a025a3cb931a62
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue Mar 31 09:14:27 2015 +0200

    Xephyr: Fix compile when debugging is enabled
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 66212ca0d2f194fd16db65e863f0a2d613e180ea)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 6a8a1ef..992930d 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -798,7 +798,7 @@ hostx_screen_init(KdScreenInfo *screen,
     }
 
     EPHYR_DBG("host_screen=%p x=%d, y=%d, wxh=%dx%d, buffer_height=%d",
-              host_screen, x, y, width, height, buffer_height);
+              screen, x, y, width, height, buffer_height);
 
     if (scrpriv->ximg != NULL) {
         /* Free up the image data if previously used
commit 70ce5753071a71d8f7c7a11a2d91599251bdb845
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue Mar 31 09:14:26 2015 +0200

    Xephyr: Print default server display number if none is specified
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b536d56aef21739b6da44693bbf19d0e7541392d)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index d6214e5..6a8a1ef 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -177,7 +177,7 @@ hostx_set_win_title(KdScreenInfo *screen, const char *extra_text)
 
         memset(buf, 0, BUF_LEN + 1);
         snprintf(buf, BUF_LEN, "Xephyr on %s.%d %s",
-                 HostX.server_dpy_name,
+                 HostX.server_dpy_name ? HostX.server_dpy_name : ":0",
                  scrpriv->mynum, (extra_text != NULL) ? extra_text : "");
 
         xcb_icccm_set_wm_name(HostX.conn,
commit a4882ac7927b3efb0fd352cd0b7f5ceeebc1250a
Author: Egbert Eich <eich at suse.de>
Date:   Tue Mar 31 09:14:25 2015 +0200

    Xephyr: Don't crash when no command line argument is specified
    
    The DDX specific command line parsing function only gets called
    if command line arguments are present. Therefore this function
    is not suitable to initialize mandatory global variables.
    Replace main() instead.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 5af73f490870da9265eeb9b3ce59a2be026be0c8)

diff --git a/configure.ac b/configure.ac
index 3247ef9..847b5c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2423,7 +2423,8 @@ if test "$KDRIVE" = yes; then
 	    fi
 	    ;;
     esac
-    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB"
+    KDRIVE_MAIN_LIB="$MAIN_LIB"
+    KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB"
     KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
     KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
     KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
@@ -2435,6 +2436,7 @@ AC_SUBST([KDRIVE_INCS])
 AC_SUBST([KDRIVE_PURE_INCS])
 AC_SUBST([KDRIVE_CFLAGS])
 AC_SUBST([KDRIVE_PURE_LIBS])
+AC_SUBST([KDRIVE_MAIN_LIB])
 AC_SUBST([KDRIVE_LOCAL_LIBS])
 AC_SUBST([KDRIVE_LIBS])
 AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 897aa19..8fbaf1d 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -52,6 +52,13 @@ void processScreenOrOutputArg(const char *screen_size, const char *output, char
 void processOutputArg(const char *output, char *parent_id);
 void processScreenArg(const char *screen_size, char *parent_id);
 
+int
+main(int argc, char *argv[], char *envp[])
+{
+    hostx_use_resname(basename(argv[0]), 0);
+    return dix_main(argc, argv, envp);
+}
+
 void
 InitCard(char *name)
 {
@@ -209,10 +216,6 @@ ddxProcessArgument(int argc, char **argv, int i)
 
     EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]);
 
-    if (i == 1) {
-        hostx_use_resname(basename(argv[0]), 0);
-    }
-
     if (!strcmp(argv[i], "-parent")) {
         if (i + 1 < argc) {
             int j;
diff --git a/hw/kdrive/fake/Makefile.am b/hw/kdrive/fake/Makefile.am
index 14c99c3..d28bd27 100644
--- a/hw/kdrive/fake/Makefile.am
+++ b/hw/kdrive/fake/Makefile.am
@@ -18,6 +18,7 @@ Xfake_SOURCES = \
 
 Xfake_LDADD = 						\
 	libfake.la					\
+	@KDRIVE_MAIN_LIB@				\
 	@KDRIVE_LIBS@
 
 Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am
index 7e8ba02..d550c13 100644
--- a/hw/kdrive/fbdev/Makefile.am
+++ b/hw/kdrive/fbdev/Makefile.am
@@ -16,6 +16,7 @@ Xfbdev_SOURCES = \
 
 Xfbdev_LDADD = 						\
 	libfbdev.la					\
+	@KDRIVE_MAIN_LIB@				\
 	@KDRIVE_LIBS@
 
 Xfbdev_DEPENDENCIES =	\
commit 0dc9da5ce94ba9fe47a992f99ff137dba4810118
Author: Jonathan Gray <jsg at jsg.id.au>
Date:   Wed Apr 15 21:29:58 2015 +1000

    glamor: fix build when DRI3 is not defined
    
    Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 00f79416b19f0cde68291aced44ab07b9b76f7b8)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 113450c..6160032 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -597,6 +597,7 @@ glamor_egl_close_screen(ScreenPtr screen)
     return screen->CloseScreen(screen);
 }
 
+#ifdef DRI3
 static int
 glamor_dri3_open_client(ClientPtr client,
                         ScreenPtr screen,
@@ -653,12 +654,12 @@ static dri3_screen_info_rec glamor_dri3_info = {
     .pixmap_from_fd = glamor_pixmap_from_fd,
     .fd_from_pixmap = glamor_fd_from_pixmap,
 };
+#endif /* DRI3 */
 
 void
 glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
 {
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
     struct glamor_egl_screen_private *glamor_egl =
         glamor_egl_get_screen_private(scrn);
 
@@ -670,7 +671,9 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
 
     glamor_ctx->make_current = glamor_egl_make_current;
 
+#ifdef DRI3
     if (glamor_egl->dri3_capable) {
+    	glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
         /* Tell the core that we have the interfaces for import/export
          * of pixmaps.
          */
@@ -693,6 +696,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
             }
         }
     }
+#endif
 }
 
 static void
commit 828a1e38030bde19ffc98ee655df5d590faf30dc
Author: Jonathan Gray <jsg at jsg.id.au>
Date:   Wed Apr 15 21:29:07 2015 +1000

    glamor: remove const from the return type of glamor_get_drawable_location()
    
    Fixes a build error with gcc 4.2.1 on OpenBSD due to
    -Werror=return-type from xorg-macros.
    
    error: type qualifiers ignored on function return type
    
    Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 7c609c911a3a33b7e4ddad46b8fc42878a073ee7)

diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 737b274..235a4ba 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -35,7 +35,7 @@
 
 #include "glamor_priv.h"
 
-const Bool
+Bool
 glamor_get_drawable_location(const DrawablePtr drawable)
 {
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index d9b38af..612701a 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -671,7 +671,7 @@ glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv,
 void glamor_init_finish_access_shaders(ScreenPtr screen);
 void glamor_fini_finish_access_shaders(ScreenPtr screen);
 
-const Bool glamor_get_drawable_location(const DrawablePtr drawable);
+Bool glamor_get_drawable_location(const DrawablePtr drawable);
 void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap,
                                 int *x, int *y);
 GLint glamor_compile_glsl_prog(GLenum type, const char *source);
commit 68eb9afb204790b586c96caa4e840a78f8bda8b6
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Mar 17 10:21:13 2015 +0900

    modesetting: Include dix-config.h from dumb_bo.c
    
    Fixes mmap failures with 32-bit builds.
    
    Signed-off-by: Michel Dänzer <michel at daenzer.net>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 145ae03814cb3b700b6fe1fd19f8fb15da84d1c8)

diff --git a/hw/xfree86/drivers/modesetting/dumb_bo.c b/hw/xfree86/drivers/modesetting/dumb_bo.c
index 58d420e..cf13f0a 100644
--- a/hw/xfree86/drivers/modesetting/dumb_bo.c
+++ b/hw/xfree86/drivers/modesetting/dumb_bo.c
@@ -25,6 +25,10 @@
  *
  */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include "dix-config.h"
+#endif
+
 #include "dumb_bo.h"
 
 #include <errno.h>
commit 554cb404a5cf146316bff6757acfa693463d141e
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Mar 17 10:21:12 2015 +0900

    Add AC_SYS_LARGEFILE defines to dix-config.h
    
    Without this, AC_SYS_LARGEFILE doesn't actually have any effect.
    
    Signed-off-by: Michel Dänzer <michel at daenzer.net>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4962c8c08842d9d3ca66d254b1ce4cacc4fb3756)

diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 1aa77a5..b0eb696 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -388,9 +388,15 @@
 /* Vendor name */
 #undef XVENDORNAME
 
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
 /* Enable GNU and other extensions to the C environment for GLIBC */
 #undef _GNU_SOURCE
 
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
commit ae3aa32688e4818979c7c59e12286365825eab53
Author: Adel Gadllah <adel.gadllah at gmail.com>
Date:   Fri May 1 17:43:41 2015 +0200

    modesetting: Fix software cursor fallback
    
    The code in drmmode_set_cursor does not properly handle the case where
    drmModeSetCursor2 returns any other error than EINVAL and silently fails to set
    a cursor.
    
    So only return when the drmModeSetCursor2 succeeds (i.e returns 0) and disable
    the cursor2 usage on EINVAL.
    
    References: https://bugzilla.redhat.com/show_bug.cgi?id=1205725
    Signed-off-by: Adel Gadllah <adel.gadllah at gmail.com>
    Reviewed-by: Michel Dänzer <michel at daenzer.net>
    Reviewed-by: Rob Clark <robdclark at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit c3ce9d8fd404ca1d4697a104ce4899525dd43c51)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 1ea799b..a8de5f9 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -427,10 +427,10 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
             drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
                               handle, ms->cursor_width, ms->cursor_height,
                               cursor->bits->xhot, cursor->bits->yhot);
+        if (!ret)
+            return;
         if (ret == -EINVAL)
             use_set_cursor2 = FALSE;
-        else
-            return;
     }
 
     ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
commit d8a39245d6cff6accf5eaeae7a1ac15eb1eb048a
Author: Dima Ryazanov <dima at gmail.com>
Date:   Wed Apr 29 22:39:18 2015 -0700

    xwayland: Implement smooth scrolling
    
    We don't even need to simulate button clicks; it's done automatically.
    This also fixes scrolling in Qt5 apps.
    
    Signed-off-by: Dima Ryazanov <dima at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 81a51a6cace6fdb54999ccdf1533dc28a2222bb9)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 04ca222..cbffea7 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -43,7 +43,7 @@ static int
 xwl_pointer_proc(DeviceIntPtr device, int what)
 {
 #define NBUTTONS 10
-#define NAXES 2
+#define NAXES 4
     BYTE map[NBUTTONS + 1];
     int i = 0;
     Atom btn_labels[NBUTTONS] = { 0 };
@@ -67,8 +67,10 @@ xwl_pointer_proc(DeviceIntPtr device, int what)
 
         axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
         axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+        axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
+        axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
 
-        if (!InitValuatorClassDeviceStruct(device, 2, btn_labels,
+        if (!InitValuatorClassDeviceStruct(device, NAXES, btn_labels,
                                            GetMotionHistorySize(), Absolute))
             return BadValue;
 
@@ -77,6 +79,13 @@ xwl_pointer_proc(DeviceIntPtr device, int what)
                                0, 0xFFFF, 10000, 0, 10000, Absolute);
         InitValuatorAxisStruct(device, 1, axes_labels[1],
                                0, 0xFFFF, 10000, 0, 10000, Absolute);
+        InitValuatorAxisStruct(device, 2, axes_labels[2],
+                               NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative);
+        InitValuatorAxisStruct(device, 3, axes_labels[3],
+                               NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative);
+
+        SetScrollValuator(device, 2, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
+        SetScrollValuator(device, 3, SCROLL_TYPE_VERTICAL, 1.0, SCROLL_FLAG_PREFERRED);
 
         if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control))
             return BadValue;
@@ -259,54 +268,24 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
                     uint32_t time, uint32_t axis, wl_fixed_t value)
 {
     struct xwl_seat *xwl_seat = data;
-    int index, count;
-    int i, val;
+    int index;
     const int divisor = 10;
     ValuatorMask mask;
 
-    if (time - xwl_seat->scroll_time > 2000) {
-        xwl_seat->vertical_scroll = 0;
-        xwl_seat->horizontal_scroll = 0;
-    }
-    xwl_seat->scroll_time = time;
-
-    /* FIXME: Need to do proper smooth scrolling here! */
     switch (axis) {
     case WL_POINTER_AXIS_VERTICAL_SCROLL:
-        xwl_seat->vertical_scroll += value / divisor;
-        val = wl_fixed_to_int(xwl_seat->vertical_scroll);
-        xwl_seat->vertical_scroll -= wl_fixed_from_int(val);
-
-        if (val <= -1)
-            index = 4;
-        else if (val >= 1)
-            index = 5;
-        else
-            return;
+        index = 3;
         break;
     case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
-        xwl_seat->horizontal_scroll += value / divisor;
-        val = wl_fixed_to_int(xwl_seat->horizontal_scroll);
-        xwl_seat->horizontal_scroll -= wl_fixed_from_int(val);
-
-        if (val <= -1)
-            index = 6;
-        else if (val >= 1)
-            index = 7;
-        else
-            return;
+        index = 2;
         break;
     default:
         return;
     }
 
     valuator_mask_zero(&mask);
-
-    count = abs(val);
-    for (i = 0; i < count; i++) {
-        QueuePointerEvents(xwl_seat->pointer, ButtonPress, index, 0, &mask);
-        QueuePointerEvents(xwl_seat->pointer, ButtonRelease, index, 0, &mask);
-    }
+    valuator_mask_set_double(&mask, index, wl_fixed_to_double(value) / divisor);
+    QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask);
 }
 
 static const struct wl_pointer_listener pointer_listener = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index bfffa71..cfb343d 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -122,10 +122,6 @@ struct xwl_seat {
     struct xorg_list link;
     CursorPtr x_cursor;
 
-    wl_fixed_t horizontal_scroll;
-    wl_fixed_t vertical_scroll;
-    uint32_t scroll_time;
-
     size_t keymap_size;
     char *keymap;
     struct wl_surface *keyboard_focus;
commit 5b23104d58eeb86e16282cdfb0553c2ffdaad169
Author: Jason Gerecke <killertofu at gmail.com>
Date:   Wed Apr 29 15:08:58 2015 +1000

    dix: Do not allow device transform to be set on valuatorless devices
    
    If a device does not have any valuators, it makes no sense to set the
    device transformation. Return a BadMatch error to let the caller know
    that they're trying something stupid.
    
    Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 9ff89a2e469ab0ac5af57d0fc115127feb1c0d99)

diff --git a/dix/devices.c b/dix/devices.c
index c4fdbe1..03290e4 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -177,6 +177,9 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             if (!isfinite(f[i]))
                 return BadValue;
 
+	if (!dev->valuator)
+		return BadMatch;
+
         if (!checkonly)
             DeviceSetTransform(dev, f);
     }
commit 6f7a3366a24a351ee49185500410811099a5eb1c
Author: Rui Matos <tiagomatos at gmail.com>
Date:   Sat Apr 25 21:19:25 2015 +0200

    dix/events: Set currentTime to the given time stamp in NoticeTime
    
    The refactoring in commit efc1035ca958f2c9d266338a308518a0834b1773
    removed the actual update of currentTime.
    
    Signed-off-by: Rui Matos <tiagomatos at gmail.com>
    Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit fa62ca68ef8be7f63cd0b899dfae3366ca9350cf)

diff --git a/dix/events.c b/dix/events.c
index b8c67fd..2500615 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1063,6 +1063,7 @@ MonthChangedOrBadTime(CARD32 *ms)
 void
 NoticeTime(const DeviceIntPtr dev, TimeStamp time)
 {
+    currentTime = time;
     lastDeviceEventTime[XIAllDevices].time = currentTime;
     lastDeviceEventTime[dev->id].time = currentTime;
 
commit 1a87dbc2ce5e6f8a7d111ef22736360fe803ba0e
Author: Brent Collins <bcollins at trustedcs.com>
Date:   Thu May 7 15:10:19 2015 -0400

    shm: Fix xselinux resource initialization for xinerama pixmaps
    
    This is necessary to avoid a NULL pointer deference when the pixmap is
    used later.
    
    [ajax: massaged commit message, fixed it to compile]
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89748
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Brent Collins <bcollins at trustedcs.com>
    (cherry picked from commit 7470578520e90b6402b2509cd0c51fd4fd84849f)

diff --git a/Xext/shm.c b/Xext/shm.c
index 52d9974..b359a90 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -971,6 +971,12 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
                                                        stuff->offset);
 
         if (pMap) {
+            result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
+                              RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
+            if (result != Success) {
+                pDraw->pScreen->DestroyPixmap(pMap);
+                return result;
+            }
             dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
             shmdesc->refcnt++;
             pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
commit 4f3df05728dd1ace88013e83347cebb64be99c03
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 14 10:36:44 2015 +0000

    shm: Fix use-after-free in ShmDestroyPixmap
    
    We pass the pPixmap->drawable.id to the ShmDetachSegment function after
    the pPixmap is freed. Fortunately, we don't use the value inside
    ShmDetachSegment and can simply pass zero instead.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Michel Dänzer <michel at daenzer.net>
    (cherry picked from commit bcec9f867d19e954a46c2654a79782bff6c65fce)

diff --git a/Xext/shm.c b/Xext/shm.c
index db9d474..52d9974 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -260,7 +260,7 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
     pScreen->DestroyPixmap = ShmDestroyPixmap;
 
     if (shmdesc)
-	ShmDetachSegment(shmdesc, pPixmap->drawable.id);
+	ShmDetachSegment(shmdesc, 0);
 
     return ret;
 }
@@ -427,7 +427,7 @@ ProcShmAttach(ClientPtr client)
 
  /*ARGSUSED*/ static int
 ShmDetachSegment(void *value, /* must conform to DeleteType */
-                 XID shmseg)
+                 XID unused)
 {
     ShmDescPtr shmdesc = (ShmDescPtr) value;
     ShmDescPtr *prev;
commit 40f35e448892e58780ff25f29df808aa68f60be3
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Apr 10 10:07:38 2015 +0200

    dix: Fix image byte order on big endian hardware
    
    Make sure X_BIG_ENDIAN/X_LITTLE_ENDIAN are defined before actually using
    them.
    
    Otherwise, image byte order could be wrong on big endian hardware even
    though endianess detection is correct.
    
    Reported-by: Tim Waugh <twaugh at redhat.com>
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 1af15aaf278edcf6f6de94774350e34a80883c24)

diff --git a/include/servermd.h b/include/servermd.h
index a3b5c3a..087826f 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -52,6 +52,8 @@ SOFTWARE.
 #error xserver code must include dix-config.h before any other headers
 #endif
 
+#include <X11/Xarch.h>		/* for X_LITTLE_ENDIAN/X_BIG_ENDIAN */
+
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
 #define IMAGE_BYTE_ORDER        LSBFirst
 #define BITMAP_BIT_ORDER        LSBFirst
commit 5497f56b8790e68c653ea4c7f36fcb4868a84b50
Author: Jason Gerecke <killertofu at gmail.com>
Date:   Thu Apr 30 18:06:14 2015 -0700

    xfree86: Return NULL from xf86CompatOutput if no compat_output is defined
    
    If no compat_output is defined, we inadvertently (attempt to) return
    whatever data is at index -1. Instead, return NULL since that's what
    callers are expecting.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
    (cherry picked from commit 28159eff6badf6181b255f26d1f444abe81c05b7)

diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 692bf40..54b6e5c 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -732,6 +732,8 @@ xf86CompatOutput(ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 
+    if (config->compat_output < 0)
+        return NULL;
     return config->output[config->compat_output];
 }
 
commit 9e39ba30f145f61c333ccf9280577d3afedfb5fb
Author: Robert Ancell <robert.ancell at canonical.com>
Date:   Wed May 6 15:07:21 2015 +1200

    xwayland: Fix error strings
    
    Fix missing newlines from error string and fix grammar.
    
    Signed-off-by: Robert Ancell <robert.ancell at canonical.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    (cherry picked from commit cad831f39861435cb94f4c90a73f7f0b62d1a4a1)

diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index dd85518..d574d94 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -310,7 +310,7 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen)
     }
 
     if (!epoxy_has_gl_extension("GL_OES_EGL_image")) {
-        ErrorF("GL_OES_EGL_image no available");
+        ErrorF("GL_OES_EGL_image not available\n");
         return;
     }
 
@@ -329,7 +329,7 @@ xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
 
    xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC);
    if (xwl_screen->drm_fd == -1) {
-       ErrorF("wayland-egl: could not open %s (%s)",
+       ErrorF("wayland-egl: could not open %s (%s)\n",
 	      xwl_screen->device_name, strerror(errno));
        return;
    }
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 5e20418..04ca222 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -567,7 +567,7 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id)
 
     xwl_seat = calloc(sizeof *xwl_seat, 1);
     if (xwl_seat == NULL) {
-        ErrorF("create_input ENOMEM");
+        ErrorF("create_input ENOMEM\n");
         return;
     }
 
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 778914c..155cbc1 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -159,7 +159,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
 
     xwl_output = calloc(sizeof *xwl_output, 1);
     if (xwl_output == NULL) {
-        ErrorF("create_output ENOMEM");
+        ErrorF("create_output ENOMEM\n");
         return NULL;
     }
 
@@ -168,7 +168,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
     wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
 
     if (snprintf(name, sizeof name, "XWAYLAND%d", serial++) < 0) {
-        ErrorF("create_output ENOMEM");
+        ErrorF("create_output ENOMEM\n");
         free(xwl_output);
         return NULL;
     }
commit 953520ef98f98ab0ca2029d9047b0ac81ad8e096
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Fri Mar 20 14:25:53 2015 +0000

    os/utils.c: Don't try to build os_move_fd() for WIN32
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    (cherry picked from commit a9b4b7b79682dd367ce26c29aa5dc85807201851)

diff --git a/os/utils.c b/os/utils.c
index 75769f1..74d73b3 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -2091,6 +2091,7 @@ FormatUInt64Hex(uint64_t num, char *string)
     string[len] = '\0';
 }
 
+#if !defined(WIN32) || defined(__CYGWIN__)
 /* Move a file descriptor out of the way of our select mask; this
  * is useful for file descriptors which will never appear in the
  * select mask to avoid reducing the number of clients that can
@@ -2114,3 +2115,4 @@ os_move_fd(int fd)
     close(fd);
     return newfd;
 }
+#endif
commit cc88bb64adda0e967c5ea0efa34aca015fa9c346
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Mar 20 14:29:58 2015 +0000

    hw/xnest: Fix build for MinGW
    
    Include the wrapped windows.h via X11/Xwindows.h before xcb_keysyms.h to avoid
    type clashes caused by the unwrapped windows.h that includes.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit 2b114d6a516ee584ff89b96b12acf91799b6d677)

diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index ee3f68e..ae8375e 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -16,6 +16,10 @@ is" without express or implied warranty.
 #include <xnest-config.h>
 #endif
 
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include <xcb/xcb_keysyms.h>
commit 36bba39db1d4b5b47bc7db5724a4370a4bcb1ecd
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Mar 18 13:29:22 2015 +0000

    hw/xwin/winclipboard: Link xwinclip with -lpthread
    
    Link xwinclip with -lpthread to fix build for MinGW
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit 5bf3e5c8326fb81655827dbd4c527f1a2ba09511)

diff --git a/hw/xwin/winclipboard/Makefile.am b/hw/xwin/winclipboard/Makefile.am
index b1c95f4..a1079ae 100644
--- a/hw/xwin/winclipboard/Makefile.am
+++ b/hw/xwin/winclipboard/Makefile.am
@@ -19,7 +19,7 @@ xwinclip_SOURCES = xwinclip.c debug.c
 
 xwinclip_CFLAGS = $(XWINMODULES_CFLAGS)
 
-xwinclip_LDADD = libXWinclipboard.la $(XWINMODULES_LIBS) -lgdi32
+xwinclip_LDADD = libXWinclipboard.la $(XWINMODULES_LIBS) -lgdi32 -lpthread
 
 include $(top_srcdir)/manpages.am
 appman_PRE = xwinclip.man
commit 5ea517fd3991e9e7c4925e5fb5660fcc597e1898
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Fri Mar 20 14:06:49 2015 +0000

    os/xdmcp.c: Include Xtrans.h when building for WIN32
    
    Xtrans.h must be included on WIN32 to prototype _XSERVTransWSAStartup()
    
    xserver/os/xdmcp.c: In function ‘get_addr_by_name’:
    xserver/os/xdmcp.c:1483:5: error: implicit declaration of function ‘_XSERVTransWSAStartup’ [-Werror=implicit-function-declaration]
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    (cherry picked from commit 8363ef2764fe9c6877d1cb21d3ce7b6cf869f00d)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index bc5a707..b265db3 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -19,6 +19,10 @@
 
 #ifdef WIN32
 #include <X11/Xwinsock.h>
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
+#include <X11/Xtrans/Xtrans.h>
 #endif
 
 #include <X11/Xos.h>
commit 2a2f676dcefbc26a9cc0c3323f62c82d92e48679
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Apr 3 19:01:40 2015 -0700

    Accept x86_64 as well as i*86 for $host_cpu in Solaris on x86
    
    Needed when using a compiler that defaults to 64-bit output when
    configure is checking for $host_cpu.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Thomas Klausner <wiz at NetBSD.org>
    (cherry picked from commit d4e85afac6578d5babc8bf97e00e85b00746fca9)

diff --git a/configure.ac b/configure.ac
index 4e47bbc..3247ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1976,7 +1976,7 @@ if test "x$XORG" = xyes; then
 		  sparc*)	
 			SOLARIS_INOUT_ARCH="sparcv8plus"
 			;;
-		  i*86)	
+		  i*86|x86_64*)
 			if test x$SOLARIS_64 = xyes ; then
 				SOLARIS_INOUT_ARCH="amd64"
 			else
commit 9b9d621f1158dc78bae3cb686c6a79db69f54425
Author: Ray Strode <rstrode at redhat.com>
Date:   Thu Apr 16 11:28:16 2015 -0400

    systemd-logind: don't second guess D-Bus default timeout
    
    At the moment, the X server uses a non-default timeout for D-Bus
    messages to systemd-logind. The only timeouts normally used with
    D-Bus are:
    
    1) Infinite
    2) Default
    
    Anything else is just as arbitrary as Default, and so rarely makes
    sense to use instead of Default.
    
    Put another way, there's little reason to be fault tolerant against
    a local root running daemon (logind), that in some configurations, the
    X server already depends on for proper functionality.
    
    This commit changes systemd-logind to just use the default timeouts.
    
    Downstream-bug: https://bugzilla.redhat.com/show_bug.cgi?id=1209347
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b1029716e41e252f149b82124a149da180607c96)

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 57c87c0..4ad41a3 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -40,8 +40,6 @@
 
 #include "systemd-logind.h"
 
-#define DBUS_TIMEOUT 500 /* Wait max 0.5 seconds */
-
 struct systemd_logind_info {
     DBusConnection *conn;
     char *session;
@@ -130,7 +128,7 @@ systemd_logind_take_fd(int _major, int _minor, const char *path,
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n",
                    path, error.message);
@@ -207,7 +205,7 @@ systemd_logind_release_fd(int _major, int _minor, int fd)
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply)
         LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n",
                    error.message);
@@ -289,7 +287,7 @@ systemd_logind_ack_pause(struct systemd_logind_info *info,
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply)
         LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n",
                    error.message);
@@ -457,7 +455,7 @@ connect_hook(DBusConnection *connection, void *data)
     }
 
     reply = dbus_connection_send_with_reply_and_block(connection, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n",
                    error.message);
@@ -492,7 +490,7 @@ connect_hook(DBusConnection *connection, void *data)
     }
 
     reply = dbus_connection_send_with_reply_and_block(connection, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n",
                    error.message);
@@ -564,7 +562,7 @@ systemd_logind_release_control(struct systemd_logind_info *info)
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n",
                    error.message);
commit bb5a8da756b70ea6625a3f7ec6cf9b75a558bfb4
Author: Ray Strode <rstrode at redhat.com>
Date:   Thu Apr 16 11:28:15 2015 -0400

    systemd-logind: filter out non-signal messages from message filter
    
    It's possible to receive a message reply in the message filter if a
    previous message call timed out locally before the reply arrived.
    
    The message_filter function only handles signals, at the moment, and
    does not properly handle message replies.
    
    This commit changes the message_filter function to filter out all
    non-signal messages, including spurious message replies.
    
    Downstream-bug: https://bugzilla.redhat.com/show_bug.cgi?id=1209347
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 792e9251670ce94210df5c6d354059bbb97f4478)

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 49758f4..57c87c0 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -313,6 +313,9 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
     dbus_int32_t major, minor;
     char *pause_str;
 
+    if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
     dbus_error_init(&error);
 
     if (dbus_message_is_signal(message,
commit 2c818e7b5db92598962f50e42b8367d7724459fb
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Apr 8 07:45:28 2015 -0700

    mi: Partial pie-slice filled arcs may need more space for spans
    
    The mi filled arc code estimates that a filled arc will produce no
    more spans than the arc is tall. This is true for most arcs except
    for pie-slice arcs strictly between 180 and 360 degrees where the missing
    portion of the arc faces up or down such that we get two spans on some
    scanlines.
    
    For those, we need to reserve room for another height/2 spans. This
    patch just does it for all partial pie-sliced arcs to make the test
    easier to understand; it's just over-allocating a bit of memory, so
    that's safe.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 41932dfbc841a1adc6512d41085ea3f8ebecb42c)

diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 246d70f..888519e 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -660,6 +660,11 @@ miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs_all, xArc * parcs)
             if (narcs && nspans + arc->height > MAX_SPANS_PER_LOOP)
                 break;
             nspans += arc->height;
+
+            /* A pie-slice arc may add another pile of spans */
+            if (pGC->arcMode == ArcPieSlice &&
+                (-FULLCIRCLE < arc->angle2 && arc->angle2 < FULLCIRCLE))
+                nspans += (arc->height + 1) >> 1;
         }
 
         pts = points = malloc (sizeof (DDXPointRec) * nspans +
commit 72b66d508acb1d5f0361b06f426ee6fc0d6ad575
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Apr 8 14:07:52 2015 +0200

    Re-enable non serverfd input devices immediately on vtenter
    
    Non serverfd input devices will never get a systemd-logind dbus resume signal,
    causing them to never get re-enabled.
    
    This commit changes xf86VTEnter() to enable them immediately, fixing this.
    
    BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89756
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 21e7d2bb5cd810688bb905b6ed092497ca8a2c59)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 16b3e28..2b84d86 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -583,10 +583,11 @@ xf86VTEnter(void)
     /* Turn screen saver off when switching back */
     dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
-    /* If we use systemd-logind it will enable input devices for us */
-    if (!systemd_logind_controls_session())
-        for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+        /* Devices with server managed fds get enabled on logind resume */
+        if (!(pInfo->flags & XI86_SERVER_FD))
             xf86EnableInputDeviceForVTSwitch(pInfo);
+    }
 
     for (ih = InputHandlers; ih; ih = ih->next) {
         if (ih->is_input)
commit 2ce54b81391d36856641c2691bcae8bd13daba4c
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Tue Dec 30 09:13:16 2014 -0800

    xfree86: Add GPU screens even if there are no active GDevs
    
    xf86platformProbeDev creates GPU screens for any platform devices that were not
    matched by a GDev in the loop above, but only if there was at least one device.
    This means that it's impossible to configure a device as a GPU screen if there
    is only one platform device that matches that driver.
    
    Instead, create a GPU screen (if possible) for any platform device that was not
    claimed by the GDev loop.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
    Acked-by: Alex Deucher <alexander.deucher at amd.com>
    (cherry picked from commit e36236eade412dd3894f75f78a7b3d7c1037e6c3)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 387b5f1..c1aaba4 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -428,6 +428,10 @@ xf86platformProbeDev(DriverPtr drvp)
 
     /* find the main device or any device specificed in xorg.conf */
     for (i = 0; i < numDevs; i++) {
+        /* skip inactive devices */
+        if (!devList[i]->active)
+            continue;
+
         for (j = 0; j < xf86_num_platform_devices; j++) {
             if (devList[i]->busID && *devList[i]->busID) {
                 if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID))
@@ -451,10 +455,14 @@ xf86platformProbeDev(DriverPtr drvp)
             continue;
     }
 
-    /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */
-    if (xf86Info.autoAddGPU && numDevs) {
+    /* if autoaddgpu devices is enabled then go find any unclaimed platform
+     * devices and add them as GPU screens */
+    if (xf86Info.autoAddGPU) {
         for (j = 0; j < xf86_num_platform_devices; j++) {
-            probeSingleDevice(&xf86_platform_devices[j], drvp, devList[0], PLATFORM_PROBE_GPU_SCREEN);
+            if (probeSingleDevice(&xf86_platform_devices[j], drvp,
+                                  devList ?  devList[0] : NULL,
+                                  PLATFORM_PROBE_GPU_SCREEN))
+                foundScreen = TRUE;
         }
     }
 
commit 905126c66c45a150932a532de14a4a10595526dc
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Tue Dec 30 09:13:15 2014 -0800

    xfree86: Fix xf86_check_platform_slot's handling of PCI
    
    If a PCI entity is found, xf86_check_platform_slot performs a device ID check
    against the xf86_platform_device passed in.  However, it just returns
    immediately without checking the rest of the entities first.  This leads to this
    situation happening:
    
    1. The nvidia driver creates an entity 0 with bus.type == BUS_PCI
    2. The intel driver creates entity 1 for its platform device, opening
       /dev/dri/card0
    3. xf86platformProbeDev calls probeSingleDevice on the Intel platform device,
       which calls doPlatformProbe, which calls xf86_check_platform_slot.
    4. xf86_check_platform_slot compares the Intel platform device against the
       NVIDIA PCI entity.  Since they don't have the same device ID, it returns
       TRUE.
    5. doPlatformProbe calls xf86ClaimPlatformSlot, which creates a duplicate entity
       for the Intel one.
    
    Fix this by only returning FALSE if the PCI ID matches, and continuing the loop
    otherwise.  In the scenario above, this allows it to continue on to find the
    Intel platform device that matches the second entity.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
    Acked-by: Alex Deucher <alexander.deucher at amd.com>
    (cherry picked from commit 4ecda362594d771f401de467c2d58c0f552227a8)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 15988b8..387b5f1 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -153,8 +153,10 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
     for (i = 0; i < xf86NumEntities; i++) {
         const EntityPtr u = xf86Entities[i];
 
-        if (pd->pdev && u->bus.type == BUS_PCI)
-            return !MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci);
+        if (pd->pdev && u->bus.type == BUS_PCI &&
+            MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) {
+            return FALSE;
+        }
         if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) {
             return FALSE;
         }
commit d8153d1767ccb60a92693c390d12f1f157e24da9
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Feb 5 12:52:02 2015 +0000

    glamor: Fix build when configured --enable-glamor --disable-xshmfence
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 8102927282d5134493e5009a876a6b01a68d1f97)

diff --git a/glamor/glamor_sync.c b/glamor/glamor_sync.c
index 5e158c3..fbc47d4 100644
--- a/glamor/glamor_sync.c
+++ b/glamor/glamor_sync.c
@@ -94,8 +94,10 @@ glamor_sync_init(ScreenPtr screen)
 			return FALSE;
 	}
 
+#ifdef HAVE_XSHMFENCE
 	if (!miSyncShmScreenInit(screen))
 		return FALSE;
+#endif
 
 	screen_funcs = miSyncGetScreenFuncs(screen);
 	glamor->saved_procs.sync_screen_funcs.CreateFence = screen_funcs->CreateFence;
commit e0bb4a1ec7a720207831732230535fc8d86fc409
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Feb 5 11:59:22 2015 +0100

    glamor: check max native ALU instructions
    
    When using glamor (either in Xephyr or Xwayland) on hardware with too
    low instructions limit, glamor fallbacks to sw due to large shaders.
    
    This makes glamor unbearably slow on such hardware.
    
    Check reported value for GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB
    and fail in glamor_init() if the limit is lower than 128.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88316
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 4218a1e066cf39bb980ebbc9f69536c85232da5c)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 6a3b336..a8cc810 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -305,6 +305,35 @@ glamor_create_screen_resources(ScreenPtr screen)
     return ret;
 }
 
+static Bool
+glamor_check_instruction_count(int gl_version)
+{
+    GLint max_native_alu_instructions;
+
+    /* Avoid using glamor if the reported instructions limit is too low,
+     * as this would cause glamor to fallback on sw due to large shaders
+     * which ends up being unbearably slow.
+     */
+    if (gl_version < 30) {
+        if (!epoxy_has_gl_extension("GL_ARB_fragment_program")) {
+            ErrorF("GL_ARB_fragment_program required\n");
+            return FALSE;
+        }
+
+        glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB,
+                          GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
+                          &max_native_alu_instructions);
+        if (max_native_alu_instructions < GLAMOR_MIN_ALU_INSTRUCTIONS) {
+            LogMessage(X_WARNING,
+                       "glamor requires at least %d instructions (%d reported)\n",
+                       GLAMOR_MIN_ALU_INSTRUCTIONS, max_native_alu_instructions);
+            return FALSE;
+        }
+    }
+
+    return TRUE;
+}
+
 /** Set up glamor for an already-configured GL context. */
 Bool
 glamor_init(ScreenPtr screen, unsigned int flags)
@@ -384,6 +413,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
             ErrorF("Require OpenGL version 2.1 or later.\n");
             goto fail;
         }
+
+        if (!glamor_check_instruction_count(gl_version))
+            goto fail;
     } else {
         if (gl_version < 20) {
             ErrorF("Require Open GLES2.0 or later.\n");
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 60070e9..d9b38af 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -1097,4 +1097,6 @@ void glamor_xv_render(glamor_port_private *port_priv);
 
 #include "glamor_font.h"
 
+#define GLAMOR_MIN_ALU_INSTRUCTIONS 128 /* Minimum required number of native ALU instructions */
+
 #endif                          /* GLAMOR_PRIV_H */
commit 9d4c8ff6736e737a98586e29d02c0afadbd35b5f
Author: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
Date:   Mon Jan 19 12:37:55 2015 +0100

    glamor: GL_TEXTURE_MAX_LEVEL is not available on GLES2
    
    Remove the calls to GL_TEXTURE_MAX_LEVEL. Setting the filtering is
    a sufficient hint to the driver about texture mipmap allocation.
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
    (cherry picked from commit 0e1372e1bd8f79fa295738bc1e983cb3648ba4be)

diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
index 8d73e47..ad4dfe6 100644
--- a/glamor/glamor_fbo.c
+++ b/glamor/glamor_fbo.c
@@ -348,7 +348,6 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
         glamor_make_current(glamor_priv);
         glGenTextures(1, &tex);
         glBindTexture(GL_TEXTURE_2D, tex);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
         glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c
index 0ca91fa..cc0fecf 100644
--- a/glamor/glamor_font.c
+++ b/glamor/glamor_font.c
@@ -97,7 +97,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     glActiveTexture(GL_TEXTURE0);
     glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
 
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 947113e..0d92710 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -717,7 +717,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
     }
 
     glBindTexture(GL_TEXTURE_2D, *tex);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
commit 3bfeccf88a3e9904bd52aa98e39c35f75320d163
Author: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
Date:   Mon Jan 12 15:29:34 2015 +0100

    glamor: Use GL_FRAMEBUFFER instead of GL_READ_FRAMEBUFFER
    
    The latter might not be available on GLES2.
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit c1f35c3d862f77cbd2fb871be5613fb0ca7e508b)

diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c
index 582d11d..6ebb12e 100644
--- a/glamor/glamor_spans.c
+++ b/glamor/glamor_spans.c
@@ -226,7 +226,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
         BoxPtr                  box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
         glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
 
-        glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+        glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
         glPixelStorei(GL_PACK_ALIGNMENT, 4);
 
         d = dst;
diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c
index c920435..aa5e861 100644
--- a/glamor/glamor_transfer.c
+++ b/glamor/glamor_transfer.c
@@ -186,7 +186,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
         BoxPtr                  boxes = in_boxes;
         int                     nbox = in_nbox;
 
-        glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+        glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
 
         while (nbox--) {
 
commit 6a37a33e4cbd0d971c30cda3ada6fc13e8414196
Author: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
Date:   Mon Jan 19 12:36:52 2015 +0100

    glamor: do not check for gl errors in glamor_build_program
    
    According to Eric Anholt the check for glGetError is not needed here.
    Because a opengl error might be set before this function is called
    keeping the check could result in glamor_build_program returning
    failure when building the shader succeeded.
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit b66501b4fd9c392e0f971ea356b27eb71c9c9e79)

diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
index 1d0328f..3207aaf 100644
--- a/glamor/glamor_program.c
+++ b/glamor/glamor_program.c
@@ -343,9 +343,6 @@ glamor_build_program(ScreenPtr          screen,
     prog->dash_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash");
     prog->dash_length_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash_length");
 
-    if (glGetError() != GL_NO_ERROR)
-        goto fail;
-
     free(version_string);
     free(fs_vars);
     free(vs_vars);
commit 1ec335ca157b1ca73306950e90ee85a93a791229
Author: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
Date:   Mon Jan 19 12:32:54 2015 +0100

    glamor: only use (un)pack_subimage when available
    
    Check for GL_EXT_unpack_subimage and GL_NV_pack_subimage to
    check if GL_(UN)PACK_ROW_LENGTH is available. Set the offsets
    manually to prevent calls to GL_(UN)PACK_SKIP_*.
    
    v2: Check support for GL_NV_pack_subimage as suggested by Matt Turner.
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 7c6f483670770e4e534cafd4e70d0b1490f4cca6)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 017266a..6a3b336 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -411,6 +411,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         epoxy_has_gl_extension("GL_ARB_buffer_storage");
     glamor_priv->has_nv_texture_barrier =
         epoxy_has_gl_extension("GL_NV_texture_barrier");
+    glamor_priv->has_unpack_subimage =
+        glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
+        epoxy_gl_version() >= 30 ||
+        epoxy_has_gl_extension("GL_EXT_unpack_subimage");
+    glamor_priv->has_pack_subimage =
+        glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
+        epoxy_gl_version() >= 30 ||
+        epoxy_has_gl_extension("GL_NV_pack_subimage");
 
     glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index ed6e2d1..60070e9 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -236,6 +236,8 @@ typedef struct glamor_screen_private {
     int has_buffer_storage;
     int has_khr_debug;
     int has_nv_texture_barrier;
+    int has_pack_subimage;
+    int has_unpack_subimage;
     int max_fbo_size;
     int has_rw_pbo;
 
diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c
index 8914155..c920435 100644
--- a/glamor/glamor_transfer.c
+++ b/glamor/glamor_transfer.c
@@ -73,7 +73,9 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
     glamor_make_current(glamor_priv);
 
     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
-    glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+
+    if (glamor_priv->has_unpack_subimage)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
 
     glamor_pixmap_loop(priv, box_x, box_y) {
         BoxPtr                  box = glamor_pixmap_box_at(priv, box_x, box_y);
@@ -92,25 +94,34 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
             int y1 = MAX(boxes->y1 + dy_dst, box->y1);
             int y2 = MIN(boxes->y2 + dy_dst, box->y2);
 
+            size_t ofs = (y1 - dy_dst + dy_src) * byte_stride;
+            ofs += (x1 - dx_dst + dx_src) * bytes_per_pixel;
+
             boxes++;
 
             if (x2 <= x1 || y2 <= y1)
                 continue;
 
-            glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src);
-            glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src);
-
-            glTexSubImage2D(GL_TEXTURE_2D, 0,
-                            x1 - box->x1, y1 - box->y1,
-                            x2 - x1, y2 - y1,
-                            format, type,
-                            bits);
+            if (glamor_priv->has_unpack_subimage ||
+                x2 - x1 == byte_stride / bytes_per_pixel) {
+                glTexSubImage2D(GL_TEXTURE_2D, 0,
+                                x1 - box->x1, y1 - box->y1,
+                                x2 - x1, y2 - y1,
+                                format, type,
+                                bits + ofs);
+            } else {
+                for (; y1 < y2; y1++, ofs += byte_stride)
+                    glTexSubImage2D(GL_TEXTURE_2D, 0,
+                                    x1 - box->x1, y1 - box->y1,
+                                    x2 - x1, 1,
+                                    format, type,
+                                    bits + ofs);
+            }
         }
     }
 
-    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-    glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
-    glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+    if (glamor_priv->has_unpack_subimage)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
 }
 
 /*
@@ -166,7 +177,8 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
     glamor_make_current(glamor_priv);
 
     glPixelStorei(GL_PACK_ALIGNMENT, 4);
-    glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+    if (glamor_priv->has_pack_subimage)
+        glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
 
     glamor_pixmap_loop(priv, box_x, box_y) {
         BoxPtr                  box = glamor_pixmap_box_at(priv, box_x, box_y);
@@ -183,20 +195,25 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
             int                     x2 = MIN(boxes->x2 + dx_src, box->x2);
             int                     y1 = MAX(boxes->y1 + dy_src, box->y1);
             int                     y2 = MIN(boxes->y2 + dy_src, box->y2);
+            size_t ofs = (y1 - dy_src + dy_dst) * byte_stride;
+            ofs += (x1 - dx_src + dx_dst) * bytes_per_pixel;
 
             boxes++;
 
             if (x2 <= x1 || y2 <= y1)
                 continue;
 
-            glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst);
-            glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst);
-            glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits);
+            if (glamor_priv->has_pack_subimage ||
+                x2 - x1 == byte_stride / bytes_per_pixel) {
+                glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs);
+            } else {
+                for (; y1 < y2; y1++, ofs += byte_stride)
+                    glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs);
+            }
         }
     }
-    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
-    glPixelStorei(GL_PACK_SKIP_ROWS, 0);
-    glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+    if (glamor_priv->has_pack_subimage)
+        glPixelStorei(GL_PACK_ROW_LENGTH, 0);
 }
 
 /*
commit 5df6982a14442e029948b704f5f6d96913e43aae
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Jan 28 16:08:26 2015 +0100

    xwayland: Add dependency on glamor libs
    
    So that Xwayland gets re-linked each time glamor is modified.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 4f534c26c64cc1edd33b04d30e4df818b7ae55d9)

diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 9945540..ab1bbb6 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -43,6 +43,7 @@ xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
 glamor_lib = $(top_builddir)/glamor/libglamor.la
 
 Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
+Xwayland_DEPENDENCIES = $(glamor_lib)
 endif
 
 EXTRA_DIST = drm.xml
commit e2bddc36af1b848974b67964b4fe4deaa79b786c
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Mon Feb 2 10:41:06 2015 +0100

    ephyr: Fail if glamor is requested but not usable
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 251a067993658fd02f158fef36476f898c238e3c)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 15edce8..d6214e5 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1407,9 +1407,12 @@ ephyr_glamor_init(ScreenPtr screen)
     ephyr_glamor_set_window_size(scrpriv->glamor,
                                  scrpriv->win_width, scrpriv->win_height);
 
-    glamor_init(screen,
-                GLAMOR_USE_SCREEN |
-                GLAMOR_USE_PICTURE_SCREEN);
+    if (!glamor_init(screen,
+                     GLAMOR_USE_SCREEN |
+                     GLAMOR_USE_PICTURE_SCREEN)) {
+        FatalError("Failed to initialize glamor\n");
+        return FALSE;
+    }
 
     return TRUE;
 }
commit e2c6135179ef0fa1b9db33f2d78e138fae233b56
Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Mar 19 12:40:06 2015 +0000

    randr: use randr: prefix in ErrorF()
    
    To provide some information about the origin of the message.
    
    Cc: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    (cherry picked from commit 93ef0e580e9cdbe739046a0873971d402525ef00)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 6d297aa..dca0691 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -428,7 +428,7 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
 
     ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix);
     if (ret == FALSE) {
-        ErrorF("failed to set shadow slave pixmap\n");
+        ErrorF("randr: failed to set shadow slave pixmap\n");
         return FALSE;
     }
 
commit 8c3a0a1904386b4630726d6be7e6dc56a50c7aa7
Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Mar 19 12:36:50 2015 +0000

    randr: remove chatty error messages
    
    All of these seem like left over from developments stage. Remove them as
    they can cause excessive flood in the logs.
    
    Cc: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    (cherry picked from commit a08ee773983c44ebb893f10a1dcfa443f2734277)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 69b3ecf..6d297aa 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -502,7 +502,6 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
 
     if (new_width == screen_pixmap->drawable.width &&
         new_height == screen_pixmap->drawable.height) {
-        ErrorF("adjust shatters %d %d\n", newsize->x1, newsize->x2);
     } else {
         pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0);
     }
@@ -557,7 +556,6 @@ RRCrtcSet(RRCrtcPtr crtc,
                 width = mode->mode.width;
                 height = mode->mode.height;
             }
-            ErrorF("have a master to look out for\n");
             ret = rrCheckPixmapBounding(master, crtc,
                                         x, y, width, height);
             if (!ret)
@@ -565,8 +563,6 @@ RRCrtcSet(RRCrtcPtr crtc,
 
             if (pScreen->current_master) {
                 ret = rrCreateSharedPixmap(crtc, width, height, x, y);
-                ErrorF("need to create shared pixmap %d", ret);
-
             }
         }
 #if RANDR_12_INTERFACE
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index e7ea49d..c2a7798 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -400,8 +400,6 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
         update_totals(iter, pScrPriv);
     }
 
-    ErrorF("reporting %d %d %d %d\n", total_crtcs, total_outputs, total_modes, total_name_len);
-
     pScrPriv = rrGetScrPriv(pScreen);
     rep = (xRRGetScreenResourcesReply) {
         .type = X_Reply,
commit 660b4469f2947a1511248468d095a327f251795d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Jun 28 14:22:07 2012 +0100

    hw/xwin: Report Cygwin version information in log
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit b2aaf69e62f4109ffb8aaf39e9bd2571abb29dfb)

diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index e8cccb4..837cdb2 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -31,6 +31,10 @@ from The Open Group.
 #include <xwin-config.h>
 #endif
 
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
 #include <../xfree86/common/xorgVersion.h>
 #include "win.h"
 #include "winconfig.h"
@@ -1181,6 +1185,16 @@ winLogVersionInfo(void)
     ErrorF("Vendor: %s\n", XVENDORNAME);
     ErrorF("Release: %d.%d.%d.%d\n", XORG_VERSION_MAJOR,
            XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
+#ifdef HAVE_SYS_UTSNAME_H
+    {
+        struct utsname name;
+
+        if (uname(&name) >= 0) {
+            ErrorF("OS: %s %s %s %s %s\n", name.sysname, name.nodename,
+                   name.release, name.version, name.machine);
+        }
+    }
+#endif
     if (strlen(BUILDERSTRING))
         ErrorF("%s\n", BUILDERSTRING);
     ErrorF("Contact: %s\n", BUILDERADDR);
commit c3db722ffebfa20b3cedf1a29201442bc4b8b92f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Mar 16 16:29:29 2015 +0000

    hw/xwin/glx: Improve code generator to deal with latest Khronos OpenGL registry XML
    
    Improve the parsing of the <proto> XML element
    
    Include all text from the param element, in the order it appears in the xml
    document, as part of the formal parameter declaration
    
    This is needed to correctly handle the XML description added in svn r27498 of
    glPathGlyphIndexRangeNV()'s baseAndCount parameter of type GLuint[2]
    
    This fixes the way the parameter declaration is generated so it is in the
    correct form 'GLuint baseAndCount_[2]' and not 'GLuint baseAndCount[2]_'
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit d02f9611c8d3bafca4be17c65efca3c5527f71e2)

diff --git a/hw/xwin/glx/gen_gl_wrappers.py b/hw/xwin/glx/gen_gl_wrappers.py
index 9627ef4..b9e8dda 100755
--- a/hw/xwin/glx/gen_gl_wrappers.py
+++ b/hw/xwin/glx/gen_gl_wrappers.py
@@ -136,9 +136,20 @@ def ParseCmdParams(cmd):
     params = cmd.elem.findall('param')
     plist=[]
     for param in params:
-        paramlist = ([t for t in param.itertext()])
-        paramtype = ''.join(paramlist[:-1])
-        paramname = paramlist[-1]
+        # construct the formal parameter definition from ptype and name
+        # elements, also using any text found around these in the
+        # param element, in the order it appears in the document
+        paramtype = ''
+        # also extract the formal parameter name from the name element
+        paramname = ''
+        for t in param.iter():
+            if t.tag == 'ptype' or t.tag == 'param':
+                paramtype = paramtype + noneStr(t.text)
+            if t.tag == 'name':
+                paramname = t.text + '_'
+                paramtype = paramtype + ' ' + paramname
+            if t.tail is not None:
+                paramtype = paramtype + t.tail.strip()
         plist.append((paramtype, paramname))
     return plist
 
@@ -206,7 +217,7 @@ class WrapperOutputGenerator(OutputGenerator):
         Comma=""
         if len(plist):
             for ptype, pname in plist:
-                self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+                self.outFile.write("%s%s"%(Comma, ptype))
                 Comma=", "
         else:
             self.outFile.write("void")
@@ -227,7 +238,7 @@ class WrapperOutputGenerator(OutputGenerator):
 
             Comma=""
             for ptype, pname in plist:
-                self.outFile.write("%s%s_"%(Comma, pname))
+                self.outFile.write("%s%s"%(Comma, pname))
                 Comma=", "
 
         # for GL 1.2+ functions, generate stdcall wrappers which use wglGetProcAddress()
@@ -253,7 +264,7 @@ class WrapperOutputGenerator(OutputGenerator):
 
             Comma=""
             for ptype, pname in plist:
-                self.outFile.write("%s%s_"%(Comma, pname))
+                self.outFile.write("%s%s"%(Comma, pname))
                 Comma=", "
         self.outFile.write(" );\n}\n\n")
 
@@ -282,10 +293,11 @@ class ThunkOutputGenerator(OutputGenerator):
         rettype=ParseCmdRettype(cmd)
         self.outFile.write("%s %sWrapper("%(rettype, name))
         plist=ParseCmdParams(cmd)
+
         Comma=""
         if len(plist):
             for ptype, pname in plist:
-                self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+                self.outFile.write("%s%s"%(Comma, ptype))
                 Comma=", "
         else:
             self.outFile.write("void")
@@ -301,7 +313,7 @@ class ThunkOutputGenerator(OutputGenerator):
 
             Comma=""
             for ptype, pname in plist:
-                self.outFile.write("%s%s_"%(Comma, pname))
+                self.outFile.write("%s%s"%(Comma, pname))
                 Comma=", "
 
         # for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
@@ -315,7 +327,7 @@ class ThunkOutputGenerator(OutputGenerator):
 
             Comma=""
             for ptype, pname in plist:
-                self.outFile.write("%s%s_"%(Comma, pname))
+                self.outFile.write("%s%s"%(Comma, pname))
                 Comma=", "
         self.outFile.write(" );\n}\n\n")
 
@@ -373,10 +385,11 @@ class ShimOutputGenerator(OutputGenerator):
         rettype=ParseCmdRettype(cmd)
         self.outFile.write("%s %s("%(rettype, name))
         plist=ParseCmdParams(cmd)
+
         Comma=""
         if len(plist):
             for ptype, pname in plist:
-                self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+                self.outFile.write("%s%s"%(Comma, ptype))
                 Comma=", "
         else:
             self.outFile.write("void")
@@ -388,7 +401,7 @@ class ShimOutputGenerator(OutputGenerator):
         if len(plist):
             Comma=""
             for ptype, pname in plist:
-                self.outFile.write("%s %s %s_"%(Comma, ptype, pname))
+                self.outFile.write("%s %s"%(Comma, ptype))
                 Comma=", "
         else:
             self.outFile.write("void")
@@ -404,7 +417,7 @@ class ShimOutputGenerator(OutputGenerator):
 
         Comma=""
         for ptype, pname in plist:
-            self.outFile.write("%s%s_"%(Comma, pname))
+            self.outFile.write("%s%s"%(Comma, pname))
             Comma=", "
 
         self.outFile.write(" );\n}\n\n")
commit 6fa7510e6af8a06bf58a5a5195ab42b2d1f4aba0
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Mar 16 16:14:10 2015 +0000

    hw/xwin/glx: Refactor parsing of the <proto> XML element
    
    Factor out duplicated code used in parsing of the <proto> XML element in the
    code generator
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit 5071cb7e0ac5f17c48ed7f3f3b6f242dec802f66)

diff --git a/hw/xwin/glx/gen_gl_wrappers.py b/hw/xwin/glx/gen_gl_wrappers.py
index 69ab1ef..9627ef4 100755
--- a/hw/xwin/glx/gen_gl_wrappers.py
+++ b/hw/xwin/glx/gen_gl_wrappers.py
@@ -123,6 +123,25 @@ else:
     errWarn = sys.stderr
 diag = open(diagFilename, 'w')
 
+def ParseCmdRettype(cmd):
+    proto=noneStr(cmd.elem.find('proto'))
+    rettype=noneStr(proto.text)
+    if rettype.lower()!="void ":
+        plist = ([t for t in proto.itertext()])
+        rettype = ''.join(plist[:-1])
+    rettype=rettype.strip()
+    return rettype
+
+def ParseCmdParams(cmd):
+    params = cmd.elem.findall('param')
+    plist=[]
+    for param in params:
+        paramlist = ([t for t in param.itertext()])
+        paramtype = ''.join(paramlist[:-1])
+        paramname = paramlist[-1]
+        plist.append((paramtype, paramname))
+    return plist
+
 class PreResolveOutputGenerator(OutputGenerator):
     def __init__(self,
                  errFile = sys.stderr,
@@ -179,21 +198,11 @@ class WrapperOutputGenerator(OutputGenerator):
         if prefix == 'wgl' and not name in used_wgl_ext_fns:
             return
 
-        proto=noneStr(cmd.elem.find('proto'))
-        rettype=noneStr(proto.text)
-        if rettype.lower()!="void ":
-            plist = ([t for t in proto.itertext()])
-            rettype = ''.join(plist[:-1])
-        rettype=rettype.strip()
+        rettype=ParseCmdRettype(cmd)
+
         if staticwrappers: self.outFile.write("static ")
         self.outFile.write("%s %sWrapper("%(rettype, name))
-        params = cmd.elem.findall('param')
-        plist=[]
-        for param in params:
-            paramlist = ([t for t in param.itertext()])
-            paramtype = ''.join(paramlist[:-1])
-            paramname = paramlist[-1]
-            plist.append((paramtype, paramname))
+        plist=ParseCmdParams(cmd)
         Comma=""
         if len(plist):
             for ptype, pname in plist:
@@ -270,20 +279,9 @@ class ThunkOutputGenerator(OutputGenerator):
     def genCmd(self, cmd, name):
         OutputGenerator.genCmd(self, cmd, name)
 
-        proto=noneStr(cmd.elem.find('proto'))
-        rettype=noneStr(proto.text)
-        if rettype.lower()!="void ":
-            plist = ([t for t in proto.itertext()])
-            rettype = ''.join(plist[:-1])
-        rettype=rettype.strip()
+        rettype=ParseCmdRettype(cmd)
         self.outFile.write("%s %sWrapper("%(rettype, name))
-        params = cmd.elem.findall('param')
-        plist=[]
-        for param in params:
-            paramlist = ([t for t in param.itertext()])
-            paramtype = ''.join(paramlist[:-1])
-            paramname = paramlist[-1]
-            plist.append((paramtype, paramname))
+        plist=ParseCmdParams(cmd)
         Comma=""
         if len(plist):
             for ptype, pname in plist:
@@ -372,20 +370,9 @@ class ShimOutputGenerator(OutputGenerator):
             return
 
         # for GL functions which are in the ABI, generate a shim which calls the function via GetProcAddress
-        proto=noneStr(cmd.elem.find('proto'))
-        rettype=noneStr(proto.text)
-        if rettype.lower()!="void ":
-            plist = ([t for t in proto.itertext()])
-            rettype = ''.join(plist[:-1])
-        rettype=rettype.strip()
+        rettype=ParseCmdRettype(cmd)
         self.outFile.write("%s %s("%(rettype, name))
-        params = cmd.elem.findall('param')
-        plist=[]
-        for param in params:
-            paramlist = ([t for t in param.itertext()])
-            paramtype = ''.join(paramlist[:-1])
-            paramname = paramlist[-1]
-            plist.append((paramtype, paramname))
+        plist=ParseCmdParams(cmd)
         Comma=""
         if len(plist):
             for ptype, pname in plist:
commit 1de38b588ecbc1a78f41a56e00ddda0e76828f77
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Feb 5 20:29:48 2015 +0000

    os: Teach vpnprintf() how to handle "%*.*s"
    
    XdmcpFatal uses the format specifier %*.*s, which vpnprintf() doesn't
    understand, which causes a backtrace and prevents the reason for the XDMCP
    failure being logged.
    
    See also:
    https://bugs.freedesktop.org/show_bug.cgi?id=66862
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758574
    
    "%*.*s" is also currently used in a few other places, so teach vpnprintf() how
    to handle it
    
    $ fgrep -r "%*.*s" *
    hw/dmx/config/scanner.l:    fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n",
    hw/dmx/dmxlog.c:        ErrorF("(%s) dmx[i%d/%*.*s]: ", type,
    hw/dmx/input/dmxinputinit.c:                dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
    os/access.c:        ErrorF("Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n",
    os/access.c:                ("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n",
    os/xdmcp.c:    FatalError("XDMCP fatal error: %s %*.*s\n", type,
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit d3080d421bf0d91daea2e39bfc391c43d7fdad75)

diff --git a/os/log.c b/os/log.c
index 0532c2e..3db5c53 100644
--- a/os/log.c
+++ b/os/log.c
@@ -355,6 +355,7 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
     uint64_t ui;
     int64_t si;
     size_t size = size_in;
+    int precision;
 
     for (; f_idx < f_len && s_idx < size - 1; f_idx++) {
         int length_modifier = 0;
@@ -365,9 +366,29 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
 
         f_idx++;
 
-        /* silently swallow digit length modifiers */
-        while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9') || f[f_idx] == '.'))
+        /* silently swallow minimum field width */
+        if (f[f_idx] == '*') {
             f_idx++;
+            va_arg(args, int);
+        } else {
+            while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9')))
+                f_idx++;
+        }
+
+        /* is there a precision? */
+        precision = size;
+        if (f[f_idx] == '.') {
+            f_idx++;
+            if (f[f_idx] == '*') {
+                f_idx++;
+                /* precision is supplied in an int argument */
+                precision = va_arg(args, int);
+            } else {
+                /* silently swallow precision digits */
+                while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9')))
+                    f_idx++;
+            }
+        }
 
         /* non-digit length modifiers */
         if (f_idx < f_len) {
@@ -383,9 +404,8 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
         switch (f[f_idx]) {
         case 's':
             string_arg = va_arg(args, char*);
-            p_len = strlen_sigsafe(string_arg);
 
-            for (i = 0; i < p_len && s_idx < size - 1; i++)
+            for (i = 0; string_arg[i] != 0 && s_idx < size - 1 && s_idx < precision; i++)
                 string[s_idx++] = string_arg[i];
             break;
 
commit 44930264eb200ea5cf43b9827e637b736b236f92
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Feb 10 14:37:26 2015 +0000

    os: XDMCP options like -query etc. should imply -listen tcp
    
    In X server 1.17, the default configuration is now -nolisten tcp.  In this
    configuration, XDMCP options don't work usefully, as the X server is not
    listening on the port for the display that it tells the display manager to
    connect to.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit 491cf02e191e70c5ce24c19da880bb79bebfc03c)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index b6e97c9..bc5a707 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -48,6 +48,11 @@
 #include <netdir.h>
 #endif
 
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
+#include <X11/Xtrans/Xtrans.h>
+
 #ifdef XDMCP
 #undef REQUEST
 
@@ -242,6 +247,14 @@ XdmcpUseMsg(void)
     ErrorF("-displayID display-id  manufacturer display ID for request\n");
 }
 
+static void
+XdmcpDefaultListen(void)
+{
+    /* Even when configured --disable-listen-tcp, we should listen on tcp in
+       XDMCP modes */
+    _XSERVTransListen("tcp");
+}
+
 int
 XdmcpOptions(int argc, char **argv, int i)
 {
@@ -249,11 +262,13 @@ XdmcpOptions(int argc, char **argv, int i)
         get_manager_by_name(argc, argv, i++);
         XDM_INIT_STATE = XDM_QUERY;
         AccessUsingXdmcp();
+        XdmcpDefaultListen();
         return i + 1;
     }
     if (strcmp(argv[i], "-broadcast") == 0) {
         XDM_INIT_STATE = XDM_BROADCAST;
         AccessUsingXdmcp();
+        XdmcpDefaultListen();
         return i + 1;
     }
 #if defined(IPv6) && defined(AF_INET6)
@@ -261,6 +276,7 @@ XdmcpOptions(int argc, char **argv, int i)
         i = get_mcast_options(argc, argv, ++i);
         XDM_INIT_STATE = XDM_MULTICAST;
         AccessUsingXdmcp();
+        XdmcpDefaultListen();
         return i + 1;
     }
 #endif
@@ -268,6 +284,7 @@ XdmcpOptions(int argc, char **argv, int i)
         get_manager_by_name(argc, argv, i++);
         XDM_INIT_STATE = XDM_INDIRECT;
         AccessUsingXdmcp();
+        XdmcpDefaultListen();
         return i + 1;
     }
     if (strcmp(argv[i], "-port") == 0) {
commit 74ab42c85b783443e67edc510307785de653a81c
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Feb 4 17:04:45 2015 +0000

    ephyr: Avoid a segfault with 'DISPLAY= Xephy -glamor'
    
    ephyr_glamor_connect() returns NULL if we failed, but applying
    xcb_connection_has_error() to NULL is not permitted.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Daniel Martin <consume.noise at gmail.com>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit f42520c5f151bda25e52ae8b0408a421c3fba7e5)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index f64861b..15edce8 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -443,7 +443,7 @@ hostx_init(void)
     else
 #endif
         HostX.conn = xcb_connect(NULL, &HostX.screen);
-    if (xcb_connection_has_error(HostX.conn)) {
+    if (!HostX.conn || xcb_connection_has_error(HostX.conn)) {
         fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
         exit(1);
     }
commit dee92c7805e0cc646feb9b7e57451848ce48be37
Author: Jürg Billeter <j at bitron.ch>
Date:   Sat Feb 7 18:13:21 2015 +0100

    int10: Fix error check for pci_device_map_legacy
    
    pci_device_map_legacy returns 0 on success.
    
    Signed-off-by: Jürg Billeter <j at bitron.ch>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56)

diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 012d194..8d5c4da 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -104,7 +104,7 @@ readIntVec(struct pci_device *dev, unsigned char *buf, int len)
 {
     void *map;
 
-    if (!pci_device_map_legacy(dev, 0, len, 0, &map))
+    if (pci_device_map_legacy(dev, 0, len, 0, &map))
         return FALSE;
 
     memcpy(buf, map, len);
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 79b9a88..6ca118f 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -75,7 +75,7 @@ readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len)
 {
     void *map;
 
-    if (!pci_device_map_legacy(dev, base, len, 0, &map))
+    if (pci_device_map_legacy(dev, base, len, 0, &map))
         return FALSE;
 
     memcpy(buf, map, len);
commit 19da4355ee975c714f0f11d31c8b41c3fdabd913
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Mar 9 09:55:57 2015 -0700

    Clear ListenTransConns entries in CloseWellKnownConnections
    
    Since _XSERVTransClose frees the connection pointer passed to it,
    remove that pointer from the array, so we don't try to double free it
    if we come back into CloseWellKnownConnections again.
    
    Should fix https://bugzilla.yoctoproject.org/show_bug.cgi?id=6665 in which
    the shutdown section of the main() loop called CloseWellKnownConnections()
    and then moved on to ddxGiveUp(), which failed to release the VT and thus
    called AbortServer(), which called CloseWellKnownConnections() again.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 7ea64fb4374504bd3d524fc08c90efdab9f253ea)

diff --git a/os/connection.c b/os/connection.c
index da3397d..64c83fc 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -519,8 +519,13 @@ CloseWellKnownConnections(void)
 {
     int i;
 
-    for (i = 0; i < ListenTransCount; i++)
-        _XSERVTransClose(ListenTransConns[i]);
+    for (i = 0; i < ListenTransCount; i++) {
+        if (ListenTransConns[i] != NULL) {
+            _XSERVTransClose(ListenTransConns[i]);
+            ListenTransConns[i] = NULL;
+        }
+    }
+    ListenTransCount = 0;
 }
 
 static void
commit a4132357c26b2140162f73d42d0b196be60373ef
Author: Michal Srb <msrb at suse.com>
Date:   Thu Feb 19 14:57:27 2015 +0200

    Expose GetMaster to modules.
    
    Add _X_EXPORT to GetMaster function. It is required by tigervnc's VNC module.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 5c4202ea85aaea2a4dc7eb29776357a2ba13e191)

diff --git a/include/input.h b/include/input.h
index bf22dc7..7212cc1 100644
--- a/include/input.h
+++ b/include/input.h
@@ -505,7 +505,7 @@ extern int AttachDevice(ClientPtr client,
                         DeviceIntPtr slave, DeviceIntPtr master);
 
 extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
-extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
+extern _X_EXPORT DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
 
 extern _X_EXPORT int AllocDevicePair(ClientPtr client,
                                      const char *name,
commit 650a1fd274f191e77a2e8b4cb7dac67b6ff596c6
Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Feb 17 14:40:27 2015 +1000

    os/access: fix regression in server interpreted auth
    
    This was reported on irc on Fedora when rawhide went to 1.17.1.
    
    regression occured in: 2566835b4374edb3e5a8353d4f7c9e7ec4851c57
     os: Eliminate uninitialized value warnings from access.c
    
    siAddrMatch doesn't need addr to be a useful value, it checks
    some things like localuser without having an address at all.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Tested-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 9d9bd38fe1454590c303dc936ddac913808bf881)

diff --git a/os/access.c b/os/access.c
index 28f2d32..8fa028e 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1392,7 +1392,7 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client)
     }
     for (host = validhosts; host; host = host->next) {
         if (host->family == FamilyServerInterpreted) {
-            if (addr && siAddrMatch(family, addr, len, host, client)) {
+            if (siAddrMatch(family, addr, len, host, client)) {
                 return 0;
             }
         }
commit 7a45d1684f626f3045305328c3aab85eed0673ea
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue Mar 3 16:27:05 2015 +0100

    symbols: Fix sdksyms.sh to cope with gcc5
    
    Gcc5 adds additional lines stating line numbers before and
    after __attribute__() which need to be skipped.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Tested-by: Daniel Stone <daniels at collabora.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 21b896939c5bb242f3aacc37baf12379e43254b6)

diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 2305073..05ac410 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -350,13 +350,25 @@ BEGIN {
     if (sdk) {
 	n = 3;
 
+        # skip line numbers GCC 5 adds before __attribute__
+        while ($n == "" || $0 ~ /^# [0-9]+ "/) {
+           getline;
+           n = 1;
+        }
+
 	# skip attribute, if any
 	while ($n ~ /^(__attribute__|__global)/ ||
 	    # skip modifiers, if any
 	    $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ ||
 	    # skip pointer
-	    $n ~ /^[a-zA-Z0-9_]*\*$/)
+	    $n ~ /^[a-zA-Z0-9_]*\*$/) {
 	    n++;
+            # skip line numbers GCC 5 adds after __attribute__
+            while ($n == "" || $0 ~ /^# [0-9]+ "/) {
+               getline;
+               n = 1;
+            }
+        }
 
 	# type specifier may not be set, as in
 	#   extern _X_EXPORT unsigned name(...)


More information about the xorg-commit mailing list