From patchwork Sun Apr 5 15:35:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 16441 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n35FZdN8013906 for ; Sun, 5 Apr 2009 15:35:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750935AbZDEPfh (ORCPT ); Sun, 5 Apr 2009 11:35:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750930AbZDEPfh (ORCPT ); Sun, 5 Apr 2009 11:35:37 -0400 Received: from mx2.redhat.com ([66.187.237.31]:49167 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbZDEPfg (ORCPT ); Sun, 5 Apr 2009 11:35:36 -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 n35FZYkY030811; Sun, 5 Apr 2009 11:35:34 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n35FZZcc015558; Sun, 5 Apr 2009 11:35:35 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n35FZXfj012752; Sun, 5 Apr 2009 11:35:34 -0400 Received: from balrog.qumranet.com (dhcp-1-197.tlv.redhat.com [10.35.1.197]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id C4DF225004B; Sun, 5 Apr 2009 18:35:05 +0300 (IDT) Message-ID: <49D8CFC5.2070203@redhat.com> Date: Sun, 05 Apr 2009 18:35:33 +0300 From: Avi Kivity User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: qemu-devel@nongnu.org CC: kvm@vger.kernel.org Subject: Re: [Qemu-devel] Re: [PATCH] Fix display breakage when resizing the screen References: <1238842115-31236-1-git-send-email-avi@redhat.com> <49D8B5C2.4090901@codemonkey.ws> In-Reply-To: <49D8B5C2.4090901@codemonkey.ws> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Anthony Liguori wrote: > > This patch breaks VC switching with -curses. > The attached incremental fixes it, by basically replicating the previous behaviour. I'll follow up with a new combined patch. diff --git a/hw/vga.c b/hw/vga.c index 404450f..54d0246 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1631,6 +1631,9 @@ static void vga_update_resolution_graphics(VGAState *s) s->multi_run != multi_run || s->multi_scan != multi_scan || s->want_full_update) { + if (s->ds->surface->pf.depth == 0) { + goto dont_touch_display_surface; + } #if defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) if (depth == 16 || depth == 32) { #else @@ -1647,6 +1650,7 @@ static void vga_update_resolution_graphics(VGAState *s) } else { qemu_console_resize(s->ds, disp_width, height); } + dont_touch_display_surface: s->last_scr_width = disp_width; s->last_scr_height = height; s->last_width = disp_width; @@ -1668,7 +1672,17 @@ static void vga_update_resolution_text(VGAState *s) cw != s->last_cw || cheight != s->last_ch || s->last_depth) { s->last_scr_width = width * cw; s->last_scr_height = height * cheight; - qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height); + if (s->ds->surface->pf.depth != 0) { + qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height); + } else { + /* + * curses expects width and height to be in character cell + * dimensions, not pixels. + */ + s->ds->surface->width = width; + s->ds->surface->height = height; + dpy_resize(s->ds); + } s->last_depth = 0; s->last_width = width; s->last_height = height;