From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0h01-0002cV-Gn for qemu-devel@nongnu.org; Thu, 23 Feb 2012 17:18:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0gzz-00068x-8d for qemu-devel@nongnu.org; Thu, 23 Feb 2012 17:18:53 -0500 Received: from e36.co.us.ibm.com ([32.97.110.154]:50210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0gzy-00067X-Su for qemu-devel@nongnu.org; Thu, 23 Feb 2012 17:18:51 -0500 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Feb 2012 15:18:47 -0700 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 941C6C90050 for ; Thu, 23 Feb 2012 17:18:44 -0500 (EST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1NMIggJ309220 for ; Thu, 23 Feb 2012 17:18:43 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q1NMIb2u006274 for ; Thu, 23 Feb 2012 20:18:38 -0200 Message-ID: <4F46BB3C.8050602@us.ibm.com> Date: Thu, 23 Feb 2012 16:18:36 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1330033159-15860-1-git-send-email-hpoussin@reactos.org> <1330033159-15860-2-git-send-email-hpoussin@reactos.org> In-Reply-To: <1330033159-15860-2-git-send-email-hpoussin@reactos.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC] sdl: initialize all graphic consoles List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Herv=E9_Poussineau?= Cc: qemu-devel@nongnu.org, Stefano Stabellini On 02/23/2012 03:39 PM, Hervé Poussineau wrote: > MIPS Jazz emulation registers two graphical consoles, but second one stays black. > This patch repairs it. > > Other display methods (cocoa, vnc...) also probably require the same kind of fix. I don't think this is really the right way to solve this problem. A bunch of assumptions are being made here and since this has been "broken" for some years now, I'm not sure that I really view this as a bug. > --- > console.c | 3 +++ > vl.c | 30 +++++++++++++++++++++--------- > 2 files changed, 24 insertions(+), 9 deletions(-) > > diff --git a/console.c b/console.c > index 135394f..2c413a7 100644 > --- a/console.c > +++ b/console.c > @@ -1376,6 +1376,9 @@ DisplayState *get_displaystate(void) > if (!display_state) { > dumb_display_init (); > } > + if (active_console&& active_console->ds) { > + return active_console->ds; > + } > return display_state; > } > > diff --git a/vl.c b/vl.c > index 7a8cc08..98e0091 100644 > --- a/vl.c > +++ b/vl.c > @@ -3451,8 +3451,14 @@ int main(int argc, char **argv, char **envp) > #endif > #if defined(CONFIG_SDL) > case DT_SDL: > - sdl_display_init(ds, full_screen, no_frame); > + { > + DisplayState *ds2 = ds; > + while (ds2) { > + sdl_display_init(ds2, full_screen, no_frame); > + ds2 = ds2->next; The fact that this works at all really surprises me. You're registering double input event handlers and doing a number of things that have a global state. sdl_display_init() isn't meant to be called twice. I really think more substantial refactoring is needed such that we're not maintaining the UI state as globals and can independently instantiate a backend for a given DisplayState. I had some patches that I posted a bit ago that started down this direction. Regards, Anthony Liguori > + } > break; > + } > #elif defined(CONFIG_COCOA) > case DT_SDL: > cocoa_display_init(ds, full_screen); > @@ -3484,15 +3490,21 @@ int main(int argc, char **argv, char **envp) > #endif > > /* display setup */ > - dpy_resize(ds); > - dcl = ds->listeners; > - while (dcl != NULL) { > - if (dcl->dpy_refresh != NULL) { > - ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); > - qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); > - break; > + { > + DisplayState *ds2 = ds; > + while (ds2 != NULL) { > + dpy_resize(ds2); > + dcl = ds2->listeners; > + while (dcl != NULL) { > + if (dcl->dpy_refresh != NULL) { > + ds2->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds2); > + qemu_mod_timer(ds2->gui_timer, qemu_get_clock_ms(rt_clock)); > + break; > + } > + dcl = dcl->next; > + } > + ds2 = ds2->next; > } > - dcl = dcl->next; > } > text_consoles_set_display(ds); >