From patchwork Fri Feb 4 17:34:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 81931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 22A83B70CD for ; Sat, 5 Feb 2011 04:38:57 +1100 (EST) Received: from localhost ([127.0.0.1]:35985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlPcU-0001td-56 for incoming@patchwork.ozlabs.org; Fri, 04 Feb 2011 12:38:54 -0500 Received: from [140.186.70.92] (port=37923 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlPYM-0000Hm-Gx for qemu-devel@nongnu.org; Fri, 04 Feb 2011 12:34:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PlPYK-0007v7-1W for qemu-devel@nongnu.org; Fri, 04 Feb 2011 12:34:38 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:39859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PlPYJ-0007ur-LB for qemu-devel@nongnu.org; Fri, 04 Feb 2011 12:34:35 -0500 Received: by wyg36 with SMTP id 36so2587874wyg.4 for ; Fri, 04 Feb 2011 09:34:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer; bh=BdArPfE564FktMppi+zrVkj7WYFF+jozd7MUKLp5PuQ=; b=ZUnMrjTcy/jZZUMoo1mm3HdEpFmyCD3pVqI1+t9z7/qk/Wrc/lpiBuo7SuU6wWpbTw 1t6+e0JUMaj544U9XqLToPkrHR4YLAsu83l7G6tULx6jse9xFBhar8RAVyTzXN4gSHCc Lb43qUVczmLjJGHHlfzu3wrRhQ7Kp4U0d9iSM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; b=r6wCghD3bRqlZZKokJYuwmVCg1Lg1qT4det2QtWxODh+NTZaXxL4FJtqHJeBz8cxdg T1nLWszKGVu4QWksSt7+Nobf7rNs74l4X8UUXYecBvUj9p1KLbODR8TqfpX2V8M+P8R/ iXi7r9InGyV+GnJW9WqGuvwkPgo2Z+MgXtG8w= Received: by 10.227.136.81 with SMTP id q17mr12595950wbt.129.1296840874764; Fri, 04 Feb 2011 09:34:34 -0800 (PST) Received: from doriath.ww600.siemens.net ([91.213.169.4]) by mx.google.com with ESMTPS id j49sm513646wer.14.2011.02.04.09.34.33 (version=SSLv3 cipher=RC4-MD5); Fri, 04 Feb 2011 09:34:33 -0800 (PST) From: Dmitry Eremin-Solenikov To: qemu-devel@nongnu.org Date: Fri, 4 Feb 2011 20:34:09 +0300 Message-Id: <1296840850-12447-1-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.7.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.173 Subject: [Qemu-devel] [PATCH 1/2] vl: initialize all displaystates X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Init not only first displaystate, but all. Otherwise machines with multiple display devices (e.g. tosa, as it exists now) will just segfault on ds switch. Signed-off-by: Dmitry Eremin-Solenikov --- vl.c | 104 +++++++++++++++++++++++++++++++++--------------------------------- 1 files changed, 52 insertions(+), 52 deletions(-) Basically this patch is equal to: @@ -3009,9 +3009,7 @@ int main(int argc, char **argv, char **envp) net_check_clients(); - /* just use the first displaystate for the moment */ - ds = get_displaystate(); - + for (ds = get_displaystate(); ds; ds = ds->next) { if (using_spice) display_remote++; if (display_type == DT_DEFAULT && !display_remote) { @@ -3077,7 +3075,9 @@ int main(int argc, char **argv, char **envp) nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); } - text_consoles_set_display(ds); + } + + text_consoles_set_display(get_displaystate()); if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) { fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n", diff --git a/vl.c b/vl.c index 14255c4..b8cd455 100644 --- a/vl.c +++ b/vl.c @@ -3009,75 +3009,75 @@ int main(int argc, char **argv, char **envp) net_check_clients(); - /* just use the first displaystate for the moment */ - ds = get_displaystate(); - - if (using_spice) - display_remote++; - if (display_type == DT_DEFAULT && !display_remote) { + for (ds = get_displaystate(); ds; ds = ds->next) { + if (using_spice) + display_remote++; + if (display_type == DT_DEFAULT && !display_remote) { #if defined(CONFIG_SDL) || defined(CONFIG_COCOA) - display_type = DT_SDL; + display_type = DT_SDL; #else - vnc_display = "localhost:0,to=99"; - show_vnc_port = 1; + vnc_display = "localhost:0,to=99"; + show_vnc_port = 1; #endif - } - + } + - /* init local displays */ - switch (display_type) { - case DT_NOGRAPHIC: - break; + /* init local displays */ + switch (display_type) { + case DT_NOGRAPHIC: + break; #if defined(CONFIG_CURSES) - case DT_CURSES: - curses_display_init(ds, full_screen); - break; + case DT_CURSES: + curses_display_init(ds, full_screen); + break; #endif #if defined(CONFIG_SDL) - case DT_SDL: - sdl_display_init(ds, full_screen, no_frame); - break; + case DT_SDL: + sdl_display_init(ds, full_screen, no_frame); + break; #elif defined(CONFIG_COCOA) - case DT_SDL: - cocoa_display_init(ds, full_screen); - break; + case DT_SDL: + cocoa_display_init(ds, full_screen); + break; #endif - default: - break; - } + default: + break; + } - /* init remote displays */ - if (vnc_display) { - vnc_display_init(ds); - if (vnc_display_open(ds, vnc_display) < 0) - exit(1); + /* init remote displays */ + if (vnc_display) { + vnc_display_init(ds); + if (vnc_display_open(ds, vnc_display) < 0) + exit(1); - if (show_vnc_port) { - printf("VNC server running on `%s'\n", vnc_display_local_addr(ds)); + if (show_vnc_port) { + printf("VNC server running on `%s'\n", vnc_display_local_addr(ds)); + } } - } #ifdef CONFIG_SPICE - if (using_spice && !qxl_enabled) { - qemu_spice_display_init(ds); - } + if (using_spice && !qxl_enabled) { + qemu_spice_display_init(ds); + } #endif - /* display setup */ - dpy_resize(ds); - dcl = ds->listeners; - while (dcl != NULL) { - if (dcl->dpy_refresh != NULL) { - ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds); - qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock)); - break; + /* display setup */ + dpy_resize(ds); + dcl = ds->listeners; + while (dcl != NULL) { + if (dcl->dpy_refresh != NULL) { + ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds); + qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock)); + break; + } + dcl = dcl->next; + } + if (ds->gui_timer == NULL) { + nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); + qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); } - dcl = dcl->next; - } - if (ds->gui_timer == NULL) { - nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); - qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); } - text_consoles_set_display(ds); + + text_consoles_set_display(get_displaystate()); if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) { fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n",