All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Akihiko Odaki <akihiko.odaki@gmail.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread
Date: Mon, 7 Mar 2022 17:39:30 +0100	[thread overview]
Message-ID: <f306bf54-e1bf-8ad6-a041-b6793bcf085f@redhat.com> (raw)
In-Reply-To: <59f773ed-9a1f-10ff-637e-b41848aa534d@gmail.com>

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


  parent reply	other threads:[~2022-03-07 16:40 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 [this message]
2022-03-07 17:03     ` Akihiko Odaki
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=f306bf54-e1bf-8ad6-a041-b6793bcf085f@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=akihiko.odaki@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.