From: Anthony Liguori <anthony@codemonkey.ws>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] use lazy initialization for display_state
Date: Fri, 19 Feb 2010 15:28:42 -0600 [thread overview]
Message-ID: <4B7F028A.8050900@codemonkey.ws> (raw)
In-Reply-To: <1265844597-29941-2-git-send-email-pbonzini@redhat.com>
On 02/10/2010 05:29 PM, Paolo Bonzini wrote:
> Ensure initialization of a dumb display, if needed, by making
> all accesses go through get_displaystate.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
>
Applied all. Thanks.
Regards,
Anthony Liguori
> ---
> vl.c | 29 +++++++++++++++--------------
> 1 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 5ddf1fe..94aeb5e 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2568,6 +2568,16 @@ struct DisplayAllocator default_allocator = {
> defaultallocator_free_displaysurface
> };
>
> +/* dumb display */
> +
> +static void dumb_display_init(void)
> +{
> + DisplayState *ds = qemu_mallocz(sizeof(DisplayState));
> + ds->allocator =&default_allocator;
> + ds->surface = qemu_create_displaysurface(ds, 640, 480);
> + register_displaystate(ds);
> +}
> +
> void register_displaystate(DisplayState *ds)
> {
> DisplayState **s;
> @@ -2580,6 +2590,9 @@ void register_displaystate(DisplayState *ds)
>
> DisplayState *get_displaystate(void)
> {
> + if (!display_state) {
> + dumb_display_init();
> + }
> return display_state;
> }
>
> @@ -2589,16 +2602,6 @@ DisplayAllocator *register_displayallocator(DisplayState *ds, DisplayAllocator *
> return ds->allocator;
> }
>
> -/* dumb display */
> -
> -static void dumb_display_init(void)
> -{
> - DisplayState *ds = qemu_mallocz(sizeof(DisplayState));
> - ds->allocator =&default_allocator;
> - ds->surface = qemu_create_displaysurface(ds, 640, 480);
> - register_displaystate(ds);
> -}
> -
> /***********************************************************/
> /* I/O handling */
>
> @@ -5871,10 +5874,8 @@ int main(int argc, char **argv, char **envp)
> if (qemu_opts_foreach(&qemu_device_opts, device_init_func, NULL, 1) != 0)
> exit(1);
>
> - if (!display_state)
> - dumb_display_init();
> /* just use the first displaystate for the moment */
> - ds = display_state;
> + ds = get_displaystate();
>
> if (display_type == DT_DEFAULT) {
> #if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
> @@ -5932,7 +5933,7 @@ int main(int argc, char **argv, char **envp)
> qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock));
> }
>
> - text_consoles_set_display(display_state);
> + text_consoles_set_display(ds);
>
> if (qemu_opts_foreach(&qemu_mon_opts, mon_init_func, NULL, 1) != 0)
> exit(1);
>
next prev parent reply other threads:[~2010-02-19 21:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 23:29 [Qemu-devel] [PATCH 0/3] move stuff out from vl.c to console.c Paolo Bonzini
2010-02-10 23:29 ` [Qemu-devel] [PATCH 1/3] use lazy initialization for display_state Paolo Bonzini
2010-02-19 21:28 ` Anthony Liguori [this message]
2010-02-10 23:29 ` [Qemu-devel] [PATCH 2/3] remove knowledge of defaultallocator_free_displaysurface from sdl.c Paolo Bonzini
2010-02-10 23:29 ` [Qemu-devel] [PATCH 3/3] move default allocator to console.c Paolo Bonzini
2010-02-11 2:10 ` [Qemu-devel] [PATCH 0/3] move stuff out from vl.c " Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B7F028A.8050900@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).