diff options
author | Egbert Eich <eich@freedesktop.org> | 2015-05-12 09:52:48 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-06-03 09:05:39 -0400 |
commit | 761be9cceb6f5a2ca883c940d6e1f277ce529ea8 (patch) | |
tree | 80551d8301ea92d30234b9212af23d9ee8688fda | |
parent | f775f247731d368c76d9bda3672fbdda7ba21223 (diff) |
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)
-rw-r--r-- | hw/kdrive/ephyr/hostx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 227931595..71c1691c4 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); |