aboutsummaryrefslogtreecommitdiff
path: root/vnc.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-04-27 16:39:51 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-01 09:44:10 -0500
commit89ee676eadde78677addb74ef8f356757f6f6c0a (patch)
tree3e69e62f1b03440eadda621e510c926bbe83a8b5 /vnc.c
parent1063b8b15fb49fcf88ffa282b19aaaf7ca9c678c (diff)
downloadqemu-89ee676eadde78677addb74ef8f356757f6f6c0a.zip
qemu-89ee676eadde78677addb74ef8f356757f6f6c0a.tar.gz
qemu-89ee676eadde78677addb74ef8f356757f6f6c0a.tar.bz2
vnc: fix server surface pixel format.
Format must be identical to the guest surface, we can't work with the 32 bpp used by the default surface allocator. Without this patch vnc doesn't get the conversions right when sending pixel data to the client. The bug triggers if (a) the client doesn't support WMVi, and (b) the guest screen depth is != 32 bpp. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vnc.c')
-rw-r--r--vnc.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/vnc.c b/vnc.c
index 7b1c227..a7a356b 100644
--- a/vnc.c
+++ b/vnc.c
@@ -366,17 +366,13 @@ static void vnc_resize(VncState *vs)
memset(vs->guest.dirty, 0xFF, sizeof(vs->guest.dirty));
/* server surface */
- if (!vs->server.ds) {
- vs->server.ds = default_allocator.create_displaysurface(ds_get_width(ds),
- ds_get_height(ds));
- } else {
- default_allocator.resize_displaysurface(vs->server.ds,
- ds_get_width(ds), ds_get_height(ds));
- }
- if (vs->server.ds->data == NULL) {
- fprintf(stderr, "vnc: memory allocation failed\n");
- exit(1);
- }
+ if (!vs->server.ds)
+ vs->server.ds = qemu_mallocz(sizeof(*vs->server.ds));
+ if (vs->server.ds->data)
+ qemu_free(vs->server.ds->data);
+ *(vs->server.ds) = *(ds->surface);
+ vs->server.ds->data = qemu_mallocz(vs->server.ds->linesize *
+ vs->server.ds->height);
memset(vs->server.dirty, 0xFF, sizeof(vs->guest.dirty));
}
@@ -919,7 +915,8 @@ int vnc_client_io_error(VncState *vs, int ret, int last_errno)
if (!vs->vd->clients)
dcl->idle = 1;
- default_allocator.free_displaysurface(vs->server.ds);
+ qemu_free(vs->server.ds->data);
+ qemu_free(vs->server.ds);
qemu_free(vs->guest.ds);
qemu_free(vs);