summaryrefslogtreecommitdiffstats
path: root/ui/console.c
diff options
context:
space:
mode:
authorGerd Hoffmann2013-02-20 09:37:12 +0100
committerAnthony Liguori2013-02-21 23:34:00 +0100
commitb1424e0381a7f1c9969079eca4458d5f20bf1859 (patch)
treed5bcee64523767227188821b45364ccfd5898ace /ui/console.c
parentRemove elderly top level TODO file (diff)
downloadqemu-b1424e0381a7f1c9969079eca4458d5f20bf1859.tar.gz
qemu-b1424e0381a7f1c9969079eca4458d5f20bf1859.tar.xz
qemu-b1424e0381a7f1c9969079eca4458d5f20bf1859.zip
vga: fix byteswapping.
In case host and guest endianness differ the vga code first creates a shared surface (using qemu_create_displaysurface_from), then goes patch the surface format to indicate that the bytes must be swapped. The switch to pixman broke that hack as the format patching isn't propagated into the pixman image, so ui code using the pixman image directly (such as vnc) uses the wrong format. Fix that by adding a byteswap parameter to qemu_create_displaysurface_from, so we'll use the correct format when creating the surface (and the pixman image) and don't have to patch the format afterwards. [ v2: unbreak xen build ] Cc: qemu-stable@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Cc: agraf@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1361349432-23884-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/console.c')
-rw-r--r--ui/console.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ui/console.c b/ui/console.c
index 0a68836d50..25e06a5cb3 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1339,11 +1339,16 @@ DisplaySurface *qemu_resize_displaysurface(DisplayState *ds,
}
DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp,
- int linesize, uint8_t *data)
+ int linesize, uint8_t *data,
+ bool byteswap)
{
DisplaySurface *surface = g_new0(DisplaySurface, 1);
- surface->pf = qemu_default_pixelformat(bpp);
+ if (byteswap) {
+ surface->pf = qemu_different_endianness_pixelformat(bpp);
+ } else {
+ surface->pf = qemu_default_pixelformat(bpp);
+ }
surface->format = qemu_pixman_get_format(&surface->pf);
assert(surface->format != 0);