Commit 89ee676eadde78677addb74ef8f356757f6f6c0a
Committed by
Anthony Liguori
1 parent
1063b8b1
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>
Showing
1 changed file
with
9 additions
and
12 deletions
vnc.c
... | ... | @@ -366,17 +366,13 @@ static void vnc_resize(VncState *vs) |
366 | 366 | memset(vs->guest.dirty, 0xFF, sizeof(vs->guest.dirty)); |
367 | 367 | |
368 | 368 | /* server surface */ |
369 | - if (!vs->server.ds) { | |
370 | - vs->server.ds = default_allocator.create_displaysurface(ds_get_width(ds), | |
371 | - ds_get_height(ds)); | |
372 | - } else { | |
373 | - default_allocator.resize_displaysurface(vs->server.ds, | |
374 | - ds_get_width(ds), ds_get_height(ds)); | |
375 | - } | |
376 | - if (vs->server.ds->data == NULL) { | |
377 | - fprintf(stderr, "vnc: memory allocation failed\n"); | |
378 | - exit(1); | |
379 | - } | |
369 | + if (!vs->server.ds) | |
370 | + vs->server.ds = qemu_mallocz(sizeof(*vs->server.ds)); | |
371 | + if (vs->server.ds->data) | |
372 | + qemu_free(vs->server.ds->data); | |
373 | + *(vs->server.ds) = *(ds->surface); | |
374 | + vs->server.ds->data = qemu_mallocz(vs->server.ds->linesize * | |
375 | + vs->server.ds->height); | |
380 | 376 | memset(vs->server.dirty, 0xFF, sizeof(vs->guest.dirty)); |
381 | 377 | } |
382 | 378 | |
... | ... | @@ -919,7 +915,8 @@ int vnc_client_io_error(VncState *vs, int ret, int last_errno) |
919 | 915 | if (!vs->vd->clients) |
920 | 916 | dcl->idle = 1; |
921 | 917 | |
922 | - default_allocator.free_displaysurface(vs->server.ds); | |
918 | + qemu_free(vs->server.ds->data); | |
919 | + qemu_free(vs->server.ds); | |
923 | 920 | qemu_free(vs->guest.ds); |
924 | 921 | qemu_free(vs); |
925 | 922 | ... | ... |