[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit 2123f7682d522619f101b05fb75efa75dabbe371
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 16 11:42:47 2015 -0400

    xserver 1.17.2
    
    Signed-off-by: Adam Jackson <ajax@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@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@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@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@gmail.com>
    Reviewed-by: Daniel Stone <daniels@collabora.com>
    Signed-off-by: Keith Packard <keithp@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@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@chris-wilson.co.uk>
    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@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@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@imgtec.com>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@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@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@redhat.com>
    Reviewed-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Signed-off-by: Keith Packard <keithp@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@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@redhat.com>
    Reviewed-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Signed-off-by: Keith Packard <keithp@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@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@redhat.com>
    Reviewed-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Signed-off-by: Keith Packard <keithp@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@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@freedesktop.org>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@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@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@freedesktop.org>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@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@freedesktop.org>
Date:   Tue Mar 31 09:14:27 2015 +0200

    Xephyr: Fix compile when debugging is enabled
    
    Signed-off-by: Egbert Eich <eich@freedesktop.org>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@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@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@freedesktop.org>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@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@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@freedesktop.org>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@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@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@jsg.id.au>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Signed-off-by: Keith Packard <keithp@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@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@jsg.id.au>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Signed-off-by: Keith Packard <keithp@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@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@daenzer.net>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Keith Packard <keithp@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@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@daenzer.net>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Keith Packard <keithp@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 */


Reply to: