qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 31819e: ui/cocoa: Ensure we have the iothread


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 31819e: ui/cocoa: Ensure we have the iothread lock when ca...
Date: Mon, 04 Mar 2019 09:45:21 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 31819e95095798382cdb5a0881f5f934a8f05476
      
https://github.com/qemu/qemu/commit/31819e95095798382cdb5a0881f5f934a8f05476
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Ensure we have the iothread lock when calling into QEMU

The Cocoa UI should run on the main thread; this is enforced
in OSX Mojave. In order to be able to run on the main thread,
we need to make sure we hold the iothread lock whenever we
call into various QEMU UI midlayer functions.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: 72a3e316daaddddf51b3dd35c72333f9503be397
      
https://github.com/qemu/qemu/commit/72a3e316daaddddf51b3dd35c72333f9503be397
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Use the pixman image directly in switchSurface

Currently the switchSurface method takes a DisplaySurface. We want
to change our DisplayChangeListener's dpy_gfx_switch callback
to do this work asynchronously on a different thread. The caller
of the switch callback will free the old DisplaySurface
immediately the callback returns, so to ensure that the
other thread doesn't access freed data we need to switch
to using the underlying pixman image instead. The pixman
image is reference counted, so we will be able to take
a reference to it to avoid it vanishing too early.

In this commit we only change the switchSurface method
to take a pixman image, and keep the flow of control
synchronous for now.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: c6fd6c705d35ad23761cc21a6aa3191de57f4d07
      
https://github.com/qemu/qemu/commit/c6fd6c705d35ad23761cc21a6aa3191de57f4d07
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Factor out initial menu creation

Factor out the long code sequence in main() which creates
the initial set of menus. This will make later patches
which move initialization code around a bit clearer.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: 8b00e4e7307c1daf611486de29c4b0011831d814
      
https://github.com/qemu/qemu/commit/8b00e4e7307c1daf611486de29c4b0011831d814
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Move console/device menu creation code up in file

Move the console/device menu creation code functions
further up in the source file, next to the code which
creates the initial menus. We're going to want to
change the location we call these functions from in
the next patch.

This commit is a pure code move with no other changes.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: 60105d7a1cbe5f347f66a422700ae073edad34f8
      
https://github.com/qemu/qemu/commit/60105d7a1cbe5f347f66a422700ae073edad34f8
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Don't call NSApp sendEvent directly from handleEvent

Currently the handleEvent method will directly call the NSApp
sendEvent method for any events that we want to let OSX deal
with. When we rearrange the event handling code, the way that
we say "let OSX have this event" is going to change. Prepare
for that by refactoring so that handleEvent returns a flag
indicating whether it consumed the event.

Suggested-by: BALATON Zoltan <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: 61a2ed447e1c0a05c4bb568c579a2d64c2d9c232
      
https://github.com/qemu/qemu/commit/61a2ed447e1c0a05c4bb568c579a2d64c2d9c232
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Subclass NSApplication so we can implement sendEvent

When we switch away from our custom event handling, we still want to
be able to have first go at any events our application receives,
because in full-screen mode we want to send key events to the guest,
even if they would be menu item activation events. There are several
ways we could do that, but one simple approach is to subclass
NSApplication so we can implement a custom sendEvent method.
Do that, but for the moment have our sendEvent just invoke the
superclass method.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: 5588840ff77800e839d8a34b7be10e5c3acd1721
      
https://github.com/qemu/qemu/commit/5588840ff77800e839d8a34b7be10e5c3acd1721
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  ui/cocoa: Perform UI operations only on the main thread

The OSX Mojave release is more picky about enforcing the Cocoa API
restriction that only the main thread may perform UI calls. To
accommodate this we need to restructure the Cocoa code:
 * the special OSX main() creates a second thread and uses
   that to call the vl.c qemu_main(); the original main
   thread goes into the OSX event loop
 * the refresh, switch and update callbacks asynchronously
   tell the main thread to do the necessary work
 * the refresh callback no longer does the "get events from the
   UI event queue and handle them" loop, since we now use
   the stock OSX event loop. Instead our NSApplication sendEvent
   method will either deal with them or pass them on to OSX

All these things have to be changed in one commit, to avoid
breaking bisection.

Note that since we use dispatch_get_main_queue(), this bumps
our minimum version requirement to OSX 10.10 Yosemite (released
in 2014, unsupported by Apple since 2017).

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
Message-id: address@hidden


  Commit: b6179aaff961627fcb59d7b234297966b81ac726
      
https://github.com/qemu/qemu/commit/b6179aaff961627fcb59d7b234297966b81ac726
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M ui/cocoa.m

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20190304' into 
staging

cocoa tree:
 * Support OSX Mojave by ensuring that we always make Cocoa UI
   function calls from the main thread, never from any other QEMU
   thread. This was previously mostly harmless, but on Mojave
   it will cause OSX to terminate the QEMU process.

# gpg: Signature made Mon 04 Mar 2019 16:48:57 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "address@hidden"
# gpg: Good signature from "Peter Maydell <address@hidden>" [ultimate]
# gpg:                 aka "Peter Maydell <address@hidden>" [ultimate]
# gpg:                 aka "Peter Maydell <address@hidden>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-cocoa-20190304:
  ui/cocoa: Perform UI operations only on the main thread
  ui/cocoa: Subclass NSApplication so we can implement sendEvent
  ui/cocoa: Don't call NSApp sendEvent directly from handleEvent
  ui/cocoa: Move console/device menu creation code up in file
  ui/cocoa: Factor out initial menu creation
  ui/cocoa: Use the pixman image directly in switchSurface
  ui/cocoa: Ensure we have the iothread lock when calling into QEMU

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/88687719c885...b6179aaff961



reply via email to

[Prev in Thread] Current Thread [Next in Thread]