[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread
From: |
Akihiko Odaki |
Subject: |
Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread |
Date: |
Tue, 8 Mar 2022 02:03:42 +0900 |
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
- [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Paolo Bonzini, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Akihiko Odaki, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Peter Maydell, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Akihiko Odaki, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Peter Maydell, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Akihiko Odaki, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Paolo Bonzini, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Akihiko Odaki, 2022/03/07
Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Paolo Bonzini, 2022/03/07
- Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread,
Akihiko Odaki <=
Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Paolo Bonzini, 2022/03/07
Re: [RFC uncompiled PATCH] cocoa: run qemu_init in the main thread, Philippe Mathieu-Daudé, 2022/03/16