File u_Xephyr-Fix-broken-image-when-endianess-of-client-machine-and-host-Xserver-differ.patch of Package xorg-x11-server.5068
From: Egbert Eich <eich@freedesktop.org>
Date: Mon Mar 30 18:03:17 2015 +0200
Subject: [PATCH]Xephyr: Fix broken image when endianess of client machine and host-Xserver differ
Patch-mainline: to be upstreamed
References: bnc#923229
Signed-off-by: Egbert Eich <eich@suse.de>
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.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
---
hw/kdrive/ephyr/hostx.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index b307b64..11a2f8e 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -691,6 +691,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);
}
@@ -818,8 +823,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);