Skip to contentSkip to conversation

ui/cocoa.m: Fix recent compile breakage

PATCH Applied Peter Maydell 5 participants 10 messages Apr 17, 2013 – May 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/cocoa.m: Fix recent compile breakage

Fix failures to compile introduced by recent console commits 1dbfa00503, 81c0d5a6) which removed is_graphic_console() and vga_hw_update() without updating the cocoa UI backend to match.

---
 ui/cocoa.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
ui/cocoa.m +4 -4
index 048cc97..d51462a 100644
@@ -495,7 +495,7 @@ QemuCocoaView *cocoaView;
                 if (keycode == 58 || keycode == 69) { // emulate caps lock and num lock keydown and keyup
                     kbd_put_keycode(keycode);
                     kbd_put_keycode(keycode | 0x80);
-                } else if (is_graphic_console()) {
+                } else if (qemu_console_is_graphic(NULL)) {
                     if (keycode & 0x80)
                         kbd_put_keycode(0xe0);
                     if (modifiers_state[keycode] == 0) { // keydown
@@ -535,7 +535,7 @@ QemuCocoaView *cocoaView;
                 }
 
             // handle keys for graphic console
-            } else if (is_graphic_console()) {
+            } else if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80) //check bit for e0 in front
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode & 0x7f); //remove e0 bit in front
@@ -578,7 +578,7 @@ QemuCocoaView *cocoaView;
             break;
         case NSKeyUp:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
-            if (is_graphic_console()) {
+            if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80)
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode | 0x80); //add 128 to signal release of key
@@ -1006,7 +1006,7 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
             [cocoaView handleEvent:event];
         }
     } while(event != nil);
-    vga_hw_update();
+    graphic_hw_update(NULL);
 }
 
 static void cocoa_cleanup(void)
Signature · 1 line
1.7.11.4
#2 lore raw
In reply to Peter Maydell

Early ping for compile-breakage fix patch (ccing Blue this time round since you've been applying patches this weekend.)

Patchwork url: http://patchwork.ozlabs.org/patch/237347/

thanks!
-- PMM

Quoted 53 lines · Peter Maydell

Fix failures to compile introduced by recent console commits 1dbfa00503, 81c0d5a6) which removed is_graphic_console() and vga_hw_update() without updating the cocoa UI backend to match.

---
 ui/cocoa.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
ui/cocoa.m +4 -5
index 048cc97..d51462a 100644
@@ -495,7 +495,7 @@ QemuCocoaView *cocoaView;
                 if (keycode == 58 || keycode == 69) { // emulate caps lock and num lock keydown and keyup
                     kbd_put_keycode(keycode);
                     kbd_put_keycode(keycode | 0x80);
-                } else if (is_graphic_console()) {
+                } else if (qemu_console_is_graphic(NULL)) {
                     if (keycode & 0x80)
                         kbd_put_keycode(0xe0);
                     if (modifiers_state[keycode] == 0) { // keydown
@@ -535,7 +535,7 @@ QemuCocoaView *cocoaView;
                 }
 
             // handle keys for graphic console
-            } else if (is_graphic_console()) {
+            } else if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80) //check bit for e0 in front
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode & 0x7f); //remove e0 bit in front
@@ -578,7 +578,7 @@ QemuCocoaView *cocoaView;
             break;
         case NSKeyUp:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
-            if (is_graphic_console()) {
+            if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80)
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode | 0x80); //add 128 to signal release of key
@@ -1006,7 +1006,7 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
             [cocoaView handleEvent:event];
         }
     } while(event != nil);
-    vga_hw_update();
+    graphic_hw_update(NULL);
 }
 
 static void cocoa_cleanup(void)
--

1.7.11.4

Applied
#3 lore raw

Thanks, applied.

Quoted 62 lines · Peter Maydell

Early ping for compile-breakage fix patch (ccing Blue this time round since you've been applying patches this weekend.)

Patchwork url: http://patchwork.ozlabs.org/patch/237347/

thanks!
-- PMM

Quoted 53 lines · Peter Maydell

Fix failures to compile introduced by recent console commits 1dbfa00503, 81c0d5a6) which removed is_graphic_console() and vga_hw_update() without updating the cocoa UI backend to match.

---
 ui/cocoa.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
ui/cocoa.m +4 -5
index 048cc97..d51462a 100644
@@ -495,7 +495,7 @@ QemuCocoaView *cocoaView;
                 if (keycode == 58 || keycode == 69) { // emulate caps lock and num lock keydown and keyup
                     kbd_put_keycode(keycode);
                     kbd_put_keycode(keycode | 0x80);
-                } else if (is_graphic_console()) {
+                } else if (qemu_console_is_graphic(NULL)) {
                     if (keycode & 0x80)
                         kbd_put_keycode(0xe0);
                     if (modifiers_state[keycode] == 0) { // keydown
@@ -535,7 +535,7 @@ QemuCocoaView *cocoaView;
                 }
 
             // handle keys for graphic console
-            } else if (is_graphic_console()) {
+            } else if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80) //check bit for e0 in front
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode & 0x7f); //remove e0 bit in front
@@ -578,7 +578,7 @@ QemuCocoaView *cocoaView;
             break;
         case NSKeyUp:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
-            if (is_graphic_console()) {
+            if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80)
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode | 0x80); //add 128 to signal release of key
@@ -1006,7 +1006,7 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
             [cocoaView handleEvent:event];
         }
     } while(event != nil);
-    vga_hw_update();
+    graphic_hw_update(NULL);
 }
 
 static void cocoa_cleanup(void)
--

1.7.11.4

#4 lore raw
In reply to Peter Maydell

Peter,

Am 21.04.2013 11:54, schrieb Peter Maydell:

Quoted 4 lines

Early ping for compile-breakage fix patch (ccing Blue this time round since you've been applying patches this weekend.)

Patchwork url: http://patchwork.ozlabs.org/patch/237347/

Even after this has been applied, things are still not building for me.

I'm seeing CC trace/generated-events.o failing with "error: parameter name omitted" for trace_apic_local_deliver, trace_usb_xhci_queue_event, trace_megasas_msix_raise and trace_spapr_pci_msi_setup, plus a warning that trace_event_count is being declared twice.

I have already rm -rf'ed build and source tree to remove any leftover generated trace files, but no change. CC'ing Stefan.

Andreas

Quoted 58 lines

thanks!
-- PMM

Quoted 53 lines · Peter Maydell

Fix failures to compile introduced by recent console commits 1dbfa00503, 81c0d5a6) which removed is_graphic_console() and vga_hw_update() without updating the cocoa UI backend to match.

---
 ui/cocoa.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
ui/cocoa.m +4 -5
index 048cc97..d51462a 100644
@@ -495,7 +495,7 @@ QemuCocoaView *cocoaView;
                 if (keycode == 58 || keycode == 69) { // emulate caps lock and num lock keydown and keyup
                     kbd_put_keycode(keycode);
                     kbd_put_keycode(keycode | 0x80);
-                } else if (is_graphic_console()) {
+                } else if (qemu_console_is_graphic(NULL)) {
                     if (keycode & 0x80)
                         kbd_put_keycode(0xe0);
                     if (modifiers_state[keycode] == 0) { // keydown
@@ -535,7 +535,7 @@ QemuCocoaView *cocoaView;
                 }
 
             // handle keys for graphic console
-            } else if (is_graphic_console()) {
+            } else if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80) //check bit for e0 in front
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode & 0x7f); //remove e0 bit in front
@@ -578,7 +578,7 @@ QemuCocoaView *cocoaView;
             break;
         case NSKeyUp:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
-            if (is_graphic_console()) {
+            if (qemu_console_is_graphic(NULL)) {
                 if (keycode & 0x80)
                     kbd_put_keycode(0xe0);
                 kbd_put_keycode(keycode | 0x80); //add 128 to signal release of key
@@ -1006,7 +1006,7 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
             [cocoaView handleEvent:event];
         }
     } while(event != nil);
-    vga_hw_update();
+    graphic_hw_update(NULL);
 }
 
 static void cocoa_cleanup(void)
--

1.7.11.4

#5 lore raw
Quoted 6 lines · Andreas Färber

Even after this has been applied, things are still not building for me.

I'm seeing CC trace/generated-events.o failing with "error: parameter name omitted" for trace_apic_local_deliver, trace_usb_xhci_queue_event, trace_megasas_msix_raise and trace_spapr_pci_msi_setup, plus a warning that trace_event_count is being declared twice.

I suspect that whatever compiler you're using here treats 'vector' as a magic word, so when it sees a prototype like
static inline void trace_megasas_msix_raise(int vector)

it's expecting that 'vector' is an attribute of the type and it wants "int vector foo", hence the error message.

You could test this theory by changing all the 'vector's in trace-events to 'vec' instead and rebuilding.

thanks
-- PMM

#6 lore raw

Il 22/04/2013 13:51, Peter Maydell ha scritto:

Quoted 12 lines · Andreas Färber
Quoted 6 lines

Even after this has been applied, things are still not building for me.

I'm seeing CC trace/generated-events.o failing with "error: parameter name omitted" for trace_apic_local_deliver, trace_usb_xhci_queue_event, trace_megasas_msix_raise and trace_spapr_pci_msi_setup, plus a warning that trace_event_count is being declared twice.

I suspect that whatever compiler you're using here treats 'vector' as a magic word, so when it sees a prototype like
static inline void trace_megasas_msix_raise(int vector)

Quoted 5 lines

it's expecting that 'vector' is an attribute of the type and it wants "int vector foo", hence the error message.

You could test this theory by changing all the 'vector's in trace-events to 'vec' instead and rebuilding.

The culprit is likely altivec.h.

Something like this should fix it:

include/qemu-common.h +8 -2
index 2cfb1f0..6c23b1b 100644
@@ -436,12 +436,18 @@
 /* vector definitions */
 #ifdef __ALTIVEC__
 #include <altivec.h>
-#define VECTYPE        vector unsigned char
+/* The altivec.h header says we're allowed to undef these for
+ * C++ compatibility.  Here we don't care about C++, but we
+ * undef them anyway to avoid namespace pollution.
+ */
+#undef vector
+#undef pixel
+#undef bool
+#define VECTYPE        __vector unsigned char
 #define SPLAT(p)       vec_splat(vec_ld(0, p), 0)
 #define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
 /* altivec.h may redefine the bool macro as vector type.
  * Reset it to POSIX semantics. */
-#undef bool
 #define bool _Bool
 #elif defined __SSE2__
 #include <emmintrin.h>

Paolo

#7 lore raw

Am 22.04.2013 14:32, schrieb Paolo Bonzini:

Quoted 16 lines

Il 22/04/2013 13:51, Peter Maydell ha scritto:

Quoted 15 lines · Andreas Färber
Quoted 6 lines

Even after this has been applied, things are still not building for me.

I'm seeing CC trace/generated-events.o failing with "error: parameter name omitted" for trace_apic_local_deliver, trace_usb_xhci_queue_event, trace_megasas_msix_raise and trace_spapr_pci_msi_setup, plus a warning that trace_event_count is being declared twice.

I suspect that whatever compiler you're using here treats 'vector' as a magic word, so when it sees a prototype like
static inline void trace_megasas_msix_raise(int vector)

it's expecting that 'vector' is an attribute of the type and it wants "int vector foo", hence the error message.

Quoted 6 lines
Quoted 2 lines

You could test this theory by changing all the 'vector's in trace-events to 'vec' instead and rebuilding.

The culprit is likely altivec.h.

Something like this should fix it:

That works fine, but one error remains:

LINK i386-softmmu/qemu-system-i386
Undefined symbols:
"___sync_val_compare_and_swap", referenced from:
_migrate_finish_set_state in migration.o
ld: symbol(s) not found
collect2: ld returned 1 exit status make[1]: *** [qemu-system-i386] Error 1
make: *** [subdir-i386-softmmu] Error 2

That seems unrelated, so I'll send out this patch later.

Thanks,
Andreas

Quoted 29 lines
include/qemu-common.h +8 -2
index 2cfb1f0..6c23b1b 100644
@@ -436,12 +436,18 @@
 /* vector definitions */
 #ifdef __ALTIVEC__
 #include <altivec.h>
-#define VECTYPE        vector unsigned char
+/* The altivec.h header says we're allowed to undef these for
+ * C++ compatibility.  Here we don't care about C++, but we
+ * undef them anyway to avoid namespace pollution.
+ */
+#undef vector
+#undef pixel
+#undef bool
+#define VECTYPE        __vector unsigned char
 #define SPLAT(p)       vec_splat(vec_ld(0, p), 0)
 #define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
 /* altivec.h may redefine the bool macro as vector type.
  * Reset it to POSIX semantics. */
-#undef bool
 #define bool _Bool
 #elif defined __SSE2__
 #include <emmintrin.h>

Paolo

#8 lore raw
Quoted 10 lines · Andreas Färber

That works fine, but one error remains:

LINK i386-softmmu/qemu-system-i386
Undefined symbols:
"___sync_val_compare_and_swap", referenced from:
_migrate_finish_set_state in migration.o
ld: symbol(s) not found
collect2: ld returned 1 exit status make[1]: *** [qemu-system-i386] Error 1
make: *** [subdir-i386-softmmu] Error 2

...does this gcc predate the atomic builtins? That could be awkward.

-- PMM

#9 lore raw

Am 05.05.2013 18:47, schrieb Peter Maydell:

Quoted 12 lines · Andreas Färber
Quoted 10 lines

That works fine, but one error remains:

LINK i386-softmmu/qemu-system-i386
Undefined symbols:
"___sync_val_compare_and_swap", referenced from:
_migrate_finish_set_state in migration.o
ld: symbol(s) not found
collect2: ld returned 1 exit status make[1]: *** [qemu-system-i386] Error 1
make: *** [subdir-i386-softmmu] Error 2

Quoted 2 lines

...does this gcc predate the atomic builtins? That could be awkward.

Oh, my fault: My 32-bit build script was not supplying --cc=gcc-4.2, so it was using 4.0.1 instead of 4.2.1.

Andreas