Skip to contentSkip to conversation

Darwin patches for 2022-03-29

GIT PULL Applied Philippe Mathieu-Daudé 3 participants 9 messages Mar 28, 2022 – Mar 29, 2022

lore
Share & tools
lore
#1 lore raw

[PULL 1/4] gitattributes: Cover Objective-C source files

In reply to Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

Apple's Git distribution actually carries a similar file which annotates *.m:
https://github.com/apple-opensource/Git/blob/73/gitattributes

See comments in commit 29cf16db23 ("buildsys: Help git-diff adding .gitattributes config file") for details.

Message-Id: <[email protected]>

---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)
.gitattributes +1 -0
index 07f430e944..a217cb7bfe 100644
@@ -1,3 +1,4 @@
 *.c.inc         diff=c
 *.h.inc         diff=c
+*.m             diff=objc
 *.py            diff=python
Signature · 1 line
2.35.1
#2 lore raw

[PULL 3/4] ui/cocoa: Respect left-command-key option

In reply to Philippe Mathieu-Daudé

From: Akihiko Odaki <[email protected]>

Fixes 4797adce5f ("ui/cocoa: add option to swap Option and Command")

Message-Id: <[email protected]>

---
 ui/cocoa.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
ui/cocoa.m +2 -1
index cb6e7c41dc..c4e5468f9e 100644
@@ -923,7 +923,8 @@ - (bool) handleEventLocked:(NSEvent *)event
                 /* Don't pass command key changes to guest unless mouse is grabbed */
                 case kVK_Command:
                     if (isMouseGrabbed &&
-                        !!(modifiers & NSEventModifierFlagCommand)) {
+                        !!(modifiers & NSEventModifierFlagCommand) &&
+                        left_command_key_enabled) {
                         if (swap_opt_cmd) {
                             [self toggleKey:Q_KEY_CODE_ALT];
                         } else {
Signature · 1 line
2.35.1
#0 lore raw

From: Philippe Mathieu-Daudé <[email protected]>

The following changes since commit 27fc9f365d6f60ff86c2e2be57289bb47a2be882:

Merge tag 'pull-ppc-20220326' of https://github.com/legoater/qemu into staging (2022-03-28 10:16:33 +0100)

are available in the Git repository at:

https://github.com/philmd/qemu.git tags/darwin-20220329

for you to fetch changes up to a4fd374364d4e23e0861273aaf7ff2ebddd57a17:

ui/console: Check console before emitting GL event (2022-03-29 00:19:37 +0200)

----------------------------------------------------------------
Darwin patches

- UI fixes

----------------------------------------------------------------

Akihiko Odaki (2):
ui/cocoa: Respect left-command-key option ui/console: Check console before emitting GL event

Philippe Mathieu-Daudé (2):
gitattributes: Cover Objective-C source files qemu/main-loop: Disable block backend global state assertion on Cocoa

 .gitattributes           |  1 +
 include/qemu/main-loop.h | 13 +++++++++++++
 ui/cocoa.m               |  3 ++-
 ui/console.c             | 21 +++++++++++++++++++++
 4 files changed, 37 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.1
#3 lore raw

[PULL 2/4] qemu/main-loop: Disable block backend global state assertion on Cocoa

From: Philippe Mathieu-Daudé <[email protected]>

Since commit 0439c5a462 ("block/block-backend.c: assertions for block-backend") QEMU crashes when using Cocoa on Darwin hosts.

Example on macOS:

  $ qemu-system-i386
  Assertion failed: (qemu_in_main_thread()), function blk_all_next, file block-backend.c, line 552.
  Abort trap: 6

Looking with lldb:

Assertion failed: (qemu_in_main_thread()), function blk_all_next, file block-backend.c, line 552. Process 76914 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert

     frame #4: 0x000000010057c2d4 qemu-system-i386`blk_all_next.cold.1
  at block-backend.c:552:5 [opt]
      549    */
      550   BlockBackend *blk_all_next(BlockBackend *blk)
      551   {
  --> 552       GLOBAL_STATE_CODE();
      553       return blk ? QTAILQ_NEXT(blk, link)
      554                  : QTAILQ_FIRST(&block_backends);
      555   }

Target 1: (qemu-system-i386) stopped.

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert

     frame #0: 0x00000001908c99b8 libsystem_kernel.dylib`__pthread_kill + 8
     frame #1: 0x00000001908fceb0 libsystem_pthread.dylib`pthread_kill + 288
     frame #2: 0x000000019083a314 libsystem_c.dylib`abort + 164
     frame #3: 0x000000019083972c libsystem_c.dylib`__assert_rtn + 300
   * frame #4: 0x000000010057c2d4 qemu-system-i386`blk_all_next.cold.1 at block-backend.c:552:5 [opt]
     frame #5: 0x00000001003c00b4 qemu-system-i386`blk_all_next(blk=<unavailable>) at block-backend.c:552:5 [opt]
     frame #6: 0x00000001003d8f04 qemu-system-i386`qmp_query_block(errp=0x0000000000000000) at qapi.c:591:16 [opt]
     frame #7: 0x000000010003ab0c qemu-system-i386`main [inlined] addRemovableDevicesMenuItems at cocoa.m:1756:21 [opt]
     frame #8: 0x000000010003ab04 qemu-system-i386`main(argc=<unavailable>, argv=<unavailable>) at cocoa.m:1980:5 [opt]
     frame #9: 0x00000001012690f4 dyld`start + 520

As we are in passed release 7.0 hard freeze, disable the block backend assertion which, while being valuable during development, is not helpful to users. We'll restore this assertion immediately once 7.0 is released and work on a fix.

Message-Id: <[email protected]>

---
 include/qemu/main-loop.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
include/qemu/main-loop.h +13 -0
index 7a4d6a0920..89bd9edefb 100644
@@ -270,10 +270,23 @@ bool qemu_mutex_iothread_locked(void);
 bool qemu_in_main_thread(void);
 
 /* Mark and check that the function is part of the global state API. */
+#ifdef CONFIG_COCOA
+/*
+ * When using the Cocoa UI, addRemovableDevicesMenuItems() is called from
+ * a thread different from the QEMU main thread and can not take the BQL,
+ * triggering this assertions in the block layer (commit 0439c5a462).
+ * As the Cocoa fix is not trivial, disable this assertion for the v7.0.0
+ * release (when using Cocoa); we will restore it immediately after the
+ * release.
+ * This issue is tracked as https://gitlab.com/qemu-project/qemu/-/issues/926
+ */
+#define GLOBAL_STATE_CODE()
+#else
 #define GLOBAL_STATE_CODE()                                         \
     do {                                                            \
         assert(qemu_in_main_thread());                              \
     } while (0)
+#endif /* CONFIG_COCOA */
 
 /* Mark and check that the function is part of the I/O API. */
 #define IO_CODE()                                                   \
Signature · 1 line
2.35.1
#4 lore raw

[PULL 4/4] ui/console: Check console before emitting GL event

In reply to Philippe Mathieu-Daudé

From: Akihiko Odaki <[email protected]>

Without this change, The GL output of a console overwrites the other consoles and makes them unusable.

Message-Id: <[email protected]>

---
 ui/console.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
ui/console.c +21 -0
index da434ce1b2..1752f2ec88 100644
@@ -1886,6 +1886,9 @@ void dpy_gl_scanout_disable(QemuConsole *con)
         con->scanout.kind = SCANOUT_NONE;
     }
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_scanout_disable) {
             dcl->ops->dpy_gl_scanout_disable(dcl);
         }
@@ -1909,6 +1912,9 @@ void dpy_gl_scanout_texture(QemuConsole *con,
         x, y, width, height
     };
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_scanout_texture) {
             dcl->ops->dpy_gl_scanout_texture(dcl, backing_id,
                                              backing_y_0_top,
@@ -1927,6 +1933,9 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con,
     con->scanout.kind = SCANOUT_DMABUF;
     con->scanout.dmabuf = dmabuf;
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_scanout_dmabuf) {
             dcl->ops->dpy_gl_scanout_dmabuf(dcl, dmabuf);
         }
@@ -1940,6 +1949,9 @@ void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
     DisplayChangeListener *dcl;
 
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_cursor_dmabuf) {
             dcl->ops->dpy_gl_cursor_dmabuf(dcl, dmabuf,
                                            have_hot, hot_x, hot_y);
@@ -1954,6 +1966,9 @@ void dpy_gl_cursor_position(QemuConsole *con,
     DisplayChangeListener *dcl;
 
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_cursor_position) {
             dcl->ops->dpy_gl_cursor_position(dcl, pos_x, pos_y);
         }
@@ -1967,6 +1982,9 @@ void dpy_gl_release_dmabuf(QemuConsole *con,
     DisplayChangeListener *dcl;
 
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_release_dmabuf) {
             dcl->ops->dpy_gl_release_dmabuf(dcl, dmabuf);
         }
@@ -1983,6 +2001,9 @@ void dpy_gl_update(QemuConsole *con,
 
     graphic_hw_gl_block(con, true);
     QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
         if (dcl->ops->dpy_gl_update) {
             dcl->ops->dpy_gl_update(dcl, x, y, w, h);
         }
Signature · 1 line
2.35.1
#5 lore raw
In reply to Philippe Mathieu-Daudé

Hi Peter,

Quoted 21 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The following changes since commit 27fc9f365d6f60ff86c2e2be57289bb47a2be882:

   Merge tag 'pull-ppc-20220326' of https://github.com/legoater/qemu into staging (2022-03-28 10:16:33 +0100)

are available in the Git repository at:

   https://github.com/philmd/qemu.git tags/darwin-20220329

for you to fetch changes up to a4fd374364d4e23e0861273aaf7ff2ebddd57a17:

ui/console: Check console before emitting GL event (2022-03-29 00:19:37 +0200)

----------------------------------------------------------------
Darwin patches

- UI fixes

----------------------------------------------------------------

Quoted 7 lines

Akihiko Odaki (2):
ui/cocoa: Respect left-command-key option ui/console: Check console before emitting GL event

Philippe Mathieu-Daudé (2):
gitattributes: Cover Objective-C source files qemu/main-loop: Disable block backend global state assertion on Cocoa

Do you mind putting this PR on hold to see Hanna's answer whether we take her patch instead:
https://lore.kernel.org/qemu-devel/[email protected]/

Thanks,

Phil.

#6 lore raw
Quoted 28 lines · Philippe Mathieu-Daudé

Hi Peter,

Quoted 25 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The following changes since commit 27fc9f365d6f60ff86c2e2be57289bb47a2be882:

   Merge tag 'pull-ppc-20220326' of https://github.com/legoater/qemu into staging (2022-03-28 10:16:33 +0100)

are available in the Git repository at:

   https://github.com/philmd/qemu.git tags/darwin-20220329

for you to fetch changes up to a4fd374364d4e23e0861273aaf7ff2ebddd57a17:

   ui/console: Check console before emitting GL event (2022-03-29 00:19:37 +0200)

----------------------------------------------------------------
Darwin patches

- UI fixes

----------------------------------------------------------------

Akihiko Odaki (2):
   ui/cocoa: Respect left-command-key option ui/console: Check console before emitting GL event

Quoted 7 lines
Quoted 3 lines

Philippe Mathieu-Daudé (2):
   gitattributes: Cover Objective-C source files qemu/main-loop: Disable block backend global state assertion on Cocoa

Do you mind putting this PR on hold to see Hanna's answer whether we take her patch instead:
https://lore.kernel.org/qemu-devel/[email protected]/

To explicitly reply here (too): I would like to rebase my patch (and subsequent PR) on this PR here.  I’d therefore like this PR to proceed (if possible).

Hanna

#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 13 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The following changes since commit 27fc9f365d6f60ff86c2e2be57289bb47a2be882:

Merge tag 'pull-ppc-20220326' of https://github.com/legoater/qemu into staging (2022-03-28 10:16:33 +0100)

are available in the Git repository at:

https://github.com/philmd/qemu.git tags/darwin-20220329

for you to fetch changes up to a4fd374364d4e23e0861273aaf7ff2ebddd57a17:

Quoted 8 lines

ui/console: Check console before emitting GL event (2022-03-29 00:19:37 +0200)

----------------------------------------------------------------
Darwin patches

- UI fixes

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM

#7 lore raw
In reply to Hanna Reitz
Quoted 33 lines · Hanna Reitz
Quoted 32 lines · Philippe Mathieu-Daudé

Hi Peter,

Quoted 28 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The following changes since commit 27fc9f365d6f60ff86c2e2be57289bb47a2be882:

   Merge tag 'pull-ppc-20220326' of https://github.com/legoater/qemu into staging (2022-03-28 10:16:33 +0100)

are available in the Git repository at:

   https://github.com/philmd/qemu.git tags/darwin-20220329

for you to fetch changes up to a4fd374364d4e23e0861273aaf7ff2ebddd57a17:

   ui/console: Check console before emitting GL event (2022-03-29 00:19:37 +0200)

----------------------------------------------------------------
Darwin patches

- UI fixes

----------------------------------------------------------------

Akihiko Odaki (2):
   ui/cocoa: Respect left-command-key option ui/console: Check console before emitting GL event

Philippe Mathieu-Daudé (2):
   gitattributes: Cover Objective-C source files qemu/main-loop: Disable block backend global state assertion on Cocoa

Quoted 6 lines
Quoted 4 lines

Do you mind putting this PR on hold to see Hanna's answer whether we take her patch instead:
https://lore.kernel.org/qemu-devel/[email protected]/

To explicitly reply here (too): I would like to rebase my patch (and subsequent PR) on this PR here.  I’d therefore like this PR to proceed (if possible).

I couldn't update earlier due to a power outage...

Thanks Hanna for following up, and Peter for merging!

Phil.