From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LyS03-0001mY-Gi for qemu-devel@nongnu.org; Mon, 27 Apr 2009 10:40:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LyRzy-0001kG-TQ for qemu-devel@nongnu.org; Mon, 27 Apr 2009 10:40:02 -0400 Received: from [199.232.76.173] (port=48305 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LyRzy-0001jt-HI for qemu-devel@nongnu.org; Mon, 27 Apr 2009 10:39:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:60870) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LyRzx-00068I-T2 for qemu-devel@nongnu.org; Mon, 27 Apr 2009 10:39:58 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3REdvB6021591 for ; Mon, 27 Apr 2009 10:39:57 -0400 From: Gerd Hoffmann Date: Mon, 27 Apr 2009 16:39:51 +0200 Message-Id: <1240843193-15967-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 1/3] vnc: fix server surface pixel format. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 --- vnc.c | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/vnc.c b/vnc.c index ab1f044..8b381c9 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)); } @@ -918,7 +914,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); -- 1.6.2.2