From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu Developers <qemu-devel@nongnu.org>
Subject: Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread
Date: Tue, 8 Mar 2022 02:03:42 +0900 [thread overview]
Message-ID: <CAMVc7JUkHeMy1oSKq4NE_dHR5QuUwzN5aTCSTMxJthR2rGNYJA@mail.gmail.com> (raw)
In-Reply-To: <f306bf54-e1bf-8ad6-a041-b6793bcf085f@redhat.com>
On Tue, Mar 8, 2022 at 1:39 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 3/7/22 16:34, Akihiko Odaki wrote:
> > Thanks for this interesting suggestion. However I don't think this
> > improves the situation much. The main contribution of this change is
> > that elimination of display_init_sem but it is still necessary for
> > command line usage of the executable.
> >
> > display_init_sem is kind of overloaded has two roles. One is to tell
> > that the QEMU is ready to initialize the display. The other is to tell
> > if it is going to initialize the display, which would not happen when it
> > is used entirely in the command line. The former role can be eliminated
> > by waiting for qemu_init, but the latter cannot be.
>
> This is easy to account for. On top of this patch:
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 44d8ea7a39..3903fa4b9b 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -96,6 +96,7 @@ static DisplayChangeListener dcl = {
> static int last_buttons;
> static int cursor_hide = 1;
> static bool full_screen;
> +static bool have_cocoa_ui;
>
> static bool stretch_video;
> static NSTextField *pauseLabel;
> @@ -1899,6 +1900,11 @@ int main (int argc, char **argv) {
>
> /* Takes iothread lock, released in applicationDidFinishLaunching:. */
> qemu_init(argc, argv);
> + if (!have_cocoa_ui) {
> + qemu_main_loop();
> + qemu_cleanup();
> + return 0;
> + }
>
> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
> @@ -2021,6 +2027,7 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
> static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
> {
> COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
> + have_cocoa_ui = 1;
> if (opts->has_full_screen && opts->full_screen) {
> full_screen = 1;
> }
>
> Paolo
This would allow to have gtk and sdl2 in the same binary.
Regards,
Akihiko Odaki
next prev parent reply other threads:[~2022-03-07 17:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-07 15:10 [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread Paolo Bonzini
2022-03-07 15:34 ` Akihiko Odaki
2022-03-07 16:14 ` Peter Maydell
2022-03-07 16:27 ` Akihiko Odaki
2022-03-07 16:35 ` Peter Maydell
2022-03-07 16:41 ` Akihiko Odaki
2022-03-07 17:21 ` Paolo Bonzini
2022-03-07 19:25 ` Akihiko Odaki
2022-03-07 16:39 ` Paolo Bonzini
2022-03-07 17:03 ` Akihiko Odaki [this message]
2022-03-07 17:06 ` Paolo Bonzini
2022-03-16 16:02 ` Philippe Mathieu-Daudé
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=CAMVc7JUkHeMy1oSKq4NE_dHR5QuUwzN5aTCSTMxJthR2rGNYJA@mail.gmail.com \
--to=akihiko.odaki@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).