Commit Graph

521 Commits

Author SHA1 Message Date
Gerd Hoffmann a76a2f729a spice: fix libvirt snapshots
Only notify spice-server about migration events in case we got
target host information beforehand.  So we kick the seamless spice
client migration only in case a actual live migration happens, not
when libvirt uses live-migration-to-file for snapshotting.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-05-08 10:45:54 +02:00
Gerd Hoffmann 4f60af9ac0 spice: fix "info spice"
In case no listening address was specified, "info spice" reports
"0.0.0.0" as address.  Which is incorrect in case spice is listening
on ipv6.  Replace it by a wildcard "*" to indicate it is not limited
to a specific address.

Note:  Being more specific is not possible without extending the
spice-server api.  The socket is handled by spice-server not
qemu, so qemu can't easily figure the actual socket address.

Reported-by: David Jaša <djasa@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-05-08 10:45:54 +02:00
Stefan Weil 6075137d94 ui: Add missing 'static' attribute
There was already a forward declaration using 'static',
but the attribute was missing in the implementation.

This fixes a warning from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-07 21:00:43 +04:00
Peter Maydell 051b9980b9 gtk: collection of fixes and cleanups by Cole Robinson
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTX3SMAAoJEEy22O7T6HE4unAQAK1fhwAdvZxA/zwsTAMhKpIF
 rhhbJvSk8Vf6Nklob+iTTvUk6epHqmWi/cU/8D2u6H7pjaJFpvuusP327htPW8M7
 EYyDnICGWFcGSvilqvE/hIEG/Fwpyz7AHPOBv/csoU5u6EN1lPO4fqyvzWEuyDMg
 H5ouYJDBTfp/sqCQRrZzii/9sCcwjRL2gmvDLeP5zGLvog9WtdbzG/jbGpoGC5cn
 fVUfieXRA0o183x8GCe33EAsyndrObPtItpGj2dCLfi2jW50UyXibj8JSh4HOzYU
 RfMmnMKDbSFhmnRPtJxavE6Ekg+ZEUN9KbiIqlcLj4EXRizmgIQc8j6Fa5a0pCJj
 hiINR/BV4rMPgEtiEPiYslgoi6H4e+AuGMgy7RtkHnnlnIDTwuEP9sgtlPpFNJ/x
 l33qIcbT5/PKREy/vhlAlQnu9ZRKbHgisewEfw8yP8iD3Yg5mqb6dxuz7wKhWccZ
 bKYQX3XOHtkbGX2guo6KZz7mq4NIUO0kB/4GU1Qd7MC89E3LmghwFdlHbtcvZ7Tt
 JsAjh+1M/+SVrOj8VGWHqdafVq0ifEdsuE5U0NVXkivIo/g181ckpP2YmPByhcLS
 +IXQX5q7w+40/wWhtRHlKz58CgpDE4w6m90jRnurDvSCXBLSXnV+jFqgQRAYQLfE
 zycUI0InTiCcPb0nKhv3
 =EjaT
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-6' into staging

gtk: collection of fixes and cleanups by Cole Robinson

# gpg: Signature made Tue 29 Apr 2014 10:44:44 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-gtk-6:
  gtk: Fix accelerators being triggered twice with gtk3
  gtk: Fix -serial vc
  gtk: Use ctrl+alt+q for quit accelerator
  gtk: Remove use of deprecated stock items
  gtk: Don't use deprecated vte_terminal_get_adjustment
  gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic
  configure: Re-run make if gtkabi/sdlabi is changed
  configure: Document --with-gtkabi

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-05-01 14:17:33 +01:00
Cole Robinson 3f2fde2a00 sdl2: Support mouse wheel
In SDL2, wheel movement is its own event, not a button event. Wire
it up similar to gtk.c

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:33 +02:00
Dave Airlie 8b15d9f1d2 sdl2: add ui info setting.
Allows you to resize the sdl2 window and have the guest notice.

[ kraxel: zero-initialize QemuUIInfo ]

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:33 +02:00
Cole Robinson 341a034742 gtk: Fix accelerators being triggered twice with gtk3
When keyboard focus is grabbed, current qemu wants to pass every
keypress to the VM, unless the user is pressing a UI accelerator.

That's exactly how things work without any of the fancy handling. Drop
the special handling, which seems to trigger accelerators twice on gtk3.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:30 +02:00
Cole Robinson d437074140 gtk: Fix -serial vc
Try kicking off a rhel5 text install over serial, the text menu navigation
is all messed up, and some of the kernel boot messages are randomly
corrupted.

Drop use of a pty and just use vte infrastructure for reading and writing.
This fixes the above corruption, and is simpler to boot.

(I don't know what was wrong with the original code though. FWIW this is
what virt-manager has done for years).

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:30 +02:00
Cole Robinson db1da1f2b5 gtk: Use ctrl+alt+q for quit accelerator
Using the standard ctrl+q makes it too easy to kill the whole VM. Using
ctrl+alt+FOO is consistent with our other accelerators.

https://bugzilla.redhat.com/show_bug.cgi?id=1062393
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:30 +02:00
Cole Robinson 3d914488ae gtk: Remove use of deprecated stock items
Stock items are deprecated. As are ImageMenuItems. Convert everything to
text only MenuItems, with the same text content as mentioned in the
conversion guide:

https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html

gtk2 users lose their menu icons as well, but I don't think that's enough
of a problem to warrant keeping around back compat code.

Example error:

ui/gtk.c:1328:5: error: ‘GtkStock’ is deprecated [-Werror=deprecated-declarations]
ui/gtk.c:1335:5: error: ‘gtk_image_menu_item_new_from_stock’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:78): Use 'gtk_menu_item_new' instead [-Werror=deprecated-declarations]
     s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:30 +02:00
Cole Robinson 105923e08c gtk: Don't use deprecated vte_terminal_get_adjustment
Guard this with a VTE version check, since I'm not sure if this is backwards
compatible.

ui/gtk.c: In function ‘gd_vc_init’:
ui/gtk.c:1176:5: error: ‘vte_terminal_get_adjustment’ is deprecated (declared at /usr/include/vte-2.90/vte/vtedeprecated.h:101) [-Werror=deprecated-declarations]

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:30 +02:00
Cole Robinson 9068f20dfb gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic
In these cases we weren't using an image in the menu item anyways, so
just do as the suggestion says. Should be fine for all qemu supported
gtk versions.

ui/gtk.c: In function ‘gd_create_menu_machine’:
ui/gtk.c:1284:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations]
     s->reset_item = gtk_image_menu_item_new_with_mnemonic(_("_Reset"));
     ^
ui/gtk.c:1287:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations]
     s->powerdown_item = gtk_image_menu_item_new_with_mnemonic(_("Power _Down"));

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-29 10:46:30 +02:00
Cole Robinson 027a79c373 vnc: Remove default_mon usage
These errors don't seem user initiated, so forcibly printing to the
monitor doesn't seem right. Just use error_report.

Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-04-25 09:19:58 -04:00
Cole Robinson 2d968ffbae input: sdl2: Fix relative mode to match SDL1 behavior
Right now relative mode accelerates too fast, and has the 'invisible wall'
problem. SDL2 added an explicit API to handle this use case, so let's use
it.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-11 12:19:16 +02:00
Cole Robinson afbc0dd649 input: sdl2: Fix guest_cursor logic
Unbreaks relative mouse mode with sdl2, just like was done with sdl.c
in c3aa84b6.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-11 12:19:16 +02:00
Takashi Iwai 800b0e814b gtk: Implement grab-on-click behavior in relative mode
This patch changes the behavior in the relative mode to be compatible
with other UIs, namely, grabbing the input at the first left click.
It improves the usability a lot; otherwise you have to press ctl-alt-G
or select from menu at each time you want to move the pointer.  Also,
the input grab is cleared when the current mode is switched to the
absolute mode.

The automatic reset of the implicit grabbing is needed since the
switching to the absolute mode happens always after the click even on
Gtk.  That is, we cannot check whether the absolute mode is already
available at the first click time even though it should have been
switched in X11 input driver side.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-08 13:57:34 +02:00
Peter Maydell bd7ce902ab spice: monitors_config: check pointer before dereferencing
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTQnunAAoJEEy22O7T6HE4li8QAL2Exsa64zpw2rUrgLIQLWRR
 28Ey0+og7Q1oFRSKkSWpTZnve29BAl/3E8x2y08RmgeBJrHdL4ASiYBVgfVZaZJF
 KgWY3e58yART4w/DBSMTix6Wq3ZD2EL00WgJWJRzmxUonIQF+WCn+bAIuXlsbdEV
 TycYsvLzP18byvd7MLUS2aErmxOoWOz8Jdta1zGyw4zdzX6L+aQG61jlxWXXpsau
 J0vzz07JnZdYsIRpQPnlsyIXrPfPRKGZ0VzB31AElgBTZ64EYu5aaLf3yQ3guyN0
 SB1smoX4exxTI078P91EhIMGsBwRI96IiuvURWvRbR/JTmfiiIJe3LVdPa1MhMC5
 pMxk3DJ4wXx+pJyZGr8eJY511oj+5jZ96cChHkTDVulpN05xxu1KNfLajukkpMIu
 BtRIDlZRYOy0Xbmv4dBh4TB8AIjLFY30gmqbNckc9LK4RIaxPSpeZq9Un19yVqMv
 SMyCu+4Z4QfYFO+zkOxf/q7fPS++WXl4ouGGm98Ax084W7YuCs5xwEV1s8+l4TcE
 EU+LOSSIuBRDhuSkoX6y0hRQLF8Mp/Q/wwMvoldzHS6aweQEIKVVfUmvH0LlS0nP
 PxWmxQ5wX0LtctGgQzRTRKuZSJEjpxKWcSmK1cVA2QUpPPQOJpW0H51FAwgVIEks
 FuqnjSm+0OLEHZoAaMD0
 =YohG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-6' into staging

spice: monitors_config: check pointer before dereferencing

# gpg: Signature made Mon 07 Apr 2014 11:19:19 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-6:
  spice: monitors_config: check pointer before dereferencing

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-04-07 12:48:34 +01:00
Gerd Hoffmann dc491cfc14 spice: monitors_config: check pointer before dereferencing
Reported-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-07 12:18:43 +02:00
Takashi Iwai ecce1929bc gtk: Remember the last grabbed pointer position
It's pretty annoying that the pointer reappears at a random place once
after grabbing and ungrabbing the input.  Better to restore to the
original position where the pointer was grabbed.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587
Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-07 10:10:16 +02:00
Takashi Iwai e61031cdd8 gtk: Fix the relative pointer tracking mode
The relative pointer tracking mode was still buggy even after the
previous fix of the motion-notify-event since the events are filtered
out when the pointer moves outside the drawing window due to the
boundary check for the absolute mode.

This patch fixes the issue by moving the unnecessary boundary check
into the if block of absolute mode, and keep the coordinate in the
relative mode even if it's outside the drawing area.  But this makes
the coordinate (last_x, last_y) possibly pointing to (-1,-1),
introduce a new flag to indicate the last coordinate has been
updated.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587
Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-07 10:10:10 +02:00
Takashi Iwai 0d0e044dee gtk: Use gtk generic event signal instead of motion-notify-event
The GDK motion-notify-event isn't generated when the pointer goes out
of the target window even if the pointer is grabbed, which essentially
means to lose the pointer tracking in gtk-ui.

Meanwhile the generic "event" signal is sent when the pointer is
grabbed, so we can use this and pick the motion notify events manually
there instead.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587
Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-07 10:09:51 +02:00
Gerd Hoffmann bdcc3a28b7 input: add sanity check
Check we've actually found a input handler before trying to call it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-01 10:17:45 +02:00
Hani Benhabiles 0419f78fae input: mouse_set should check input device type.
Otherwise, the index of an input device like a usb-kbd is silently accepted.

(qemu) info mice
  Mouse #2: QEMU PS/2 Mouse
* Mouse #3: QEMU HID Mouse
(qemu) mouse_set 1
(qemu) info mice
  Mouse #2: QEMU PS/2 Mouse
* Mouse #3: QEMU HID Mouse

Also replace monitor_printf() call in do_mouse_set() with error_report() and
adjust error message.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-01 10:17:45 +02:00
Stefan Weil bbbf9bfb9c gtk: Support GTK without VTE
GTK without VTE is needed for hosts which don't support VTE (for example
all variants of MinGW), but it can also be reasonable for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2014-03-26 05:33:02 +01:00
Cole Robinson b2c494c3a4 spice: input: Fix absolute mouse y coordinates
Current tablet + spice is unusable. Regressed with the UI input rework.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-24 08:41:21 +01:00
Stefan Hajnoczi 39f72ef94b qom: Add check() argument to object_property_add_link()
There are currently three types of object_property_add_link() callers:

1. The link property may be set at any time.
2. The link property of a DeviceState instance may only be set before
   realize.
3. The link property may never be set, it is read-only.

Something similar can already be achieved with
object_property_add_str()'s set() argument.  Follow its example and add
a check() argument to object_property_add_link().

Also provide default check() functions for case #1 and #2.  Case #3 is
covered by passing a NULL function pointer.

Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Tweaked documentation comment]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-19 22:23:13 +01:00
Stefan Hajnoczi 9561fda8d9 qom: Make QOM link property unref optional
Some object_property_add_link() callers expect property deletion to
unref the link property object.  Other callers expect to manage the
refcount themselves.  The former are currently broken and therefore leak
the link property object.

This patch adds a flags argument to object_property_add_link() so the
caller can specify which refcount behavior they require.  The new
OBJ_PROP_LINK_UNREF_ON_RELEASE flag causes the link pointer to be
unreferenced when the property is deleted.

This fixes refcount leaks in qdev.c, xilinx_axidma.c, xilinx_axienet.c,
s390-virtio-bus.c, virtio-pci.c, virtio-rng.c, and ui/console.c.

Rationale for refcount behavior:

 * hw/core/qdev.c
   - bus children are explicitly unreferenced, don't interfere
   - parent_bus is essentially a read-only property that doesn't hold a
     refcount, don't unref
   - hotplug_handler is leaked, do unref

 * hw/dma/xilinx_axidma.c
   - rx stream "dma" links are set using set_link, therefore they
     need unref
   - tx streams are set using set_link, therefore they need unref

 * hw/net/xilinx_axienet.c
   - same reasoning as hw/dma/xilinx_axidma.c

 * hw/pcmcia/pxa2xx.c
   - pxa2xx bypasses set_link and therefore does not use refcounts

 * hw/s390x/s390-virtio-bus.c
 * hw/virtio/virtio-pci.c
 * hw/virtio/virtio-rng.c
 * ui/console.c
   - set_link is used and there is no explicit unref, do unref

Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-19 22:05:20 +01:00
Peter Lieven 2f487a3d40 ui/vnc: fix vmware VGA incompatiblities
this fixes invalid rectangle updates observed after commit 12b316d
with the vmware VGA driver. The issues occured because the server
and client surface update seems to be out of sync at some points
and the max width of the surface is not dividable by
VNC_DIRTY_BITS_PER_PIXEL (16).

Reported-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-18 08:21:24 +01:00
Cole Robinson 2bda66028b gtk: Don't warp absolute pointer
This matches the behavior of SDL, and makes the mouse usable when
using -display gtk -vga qxl

https://bugzilla.redhat.com/show_bug.cgi?id=1051724
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-17 14:34:28 +01:00
Cole Robinson 298526fe92 gtk: Fix mouse warping with gtk3
We were using the wrong coordinates, this fixes things to match the
original gtk2 implementation.

You can see this error in action by using -vga qxl, however even after this
patch the mouse warps in small increments up and to the left, -7x and -3y
pixels at a time, until the pointer is warped off the widget. I think it's
a qxl bug, but the next patch covers it up.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-17 14:34:28 +01:00
Jan Kiszka 881249c792 gtk: Allow to activate grab-on-hover from the command line
As long as we have no persistent GTK configuration, this allows to
enable the useful grab-on-hover feature already when starting the VM.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

[ kraxel: fix warning with CONFIG_GTK=n ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-17 14:33:55 +01:00
Jan Kiszka d58b912271 gtk: Add mouse wheel support
Hook into scroll-event to properly forward mouse wheel movements to the
guest, just like we already do in SDL.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-12 10:44:45 +01:00
Gerd Hoffmann 7f5e07d9b3 input: activate legacy kbd
Restores traditional behavior:  Keyboard input will be routed to the most
recently added keyboard.  Without this all kbd input goes to the ps/2
keyboard, even if you add a usb keyboard to your guest.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-12 10:43:16 +01:00
Peter Maydell ed9b103d3e minor spice patches.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTHbpqAAoJEEy22O7T6HE4erMP/Axq1jLKpZxbZRJjYYmncyxP
 Eps2m6yR5NEXCtULyD0PiAC1Aomf4ztx0GfOpTari6mhUGdnzZsQyUhFZvJtnOUv
 lfDrc3Sb5IRapjN5Y3Ev0VEfqKl5jsNA0Q1RqbYnfiejU3VuI8BeIvPBStsTyoNy
 zqB/pJgW1c85IOx34tQQqgG0r/6lHTE/8A3aZqrNHIa1MfxTeBewPUHAOskbsh5x
 oLZ1vWvPW7Klk4G6XjMjBYsBo71WExFyQEtQsxUP5iOho+W0U4x0WMb7WyKw5S/4
 MG8440oQxRlR7zOua7KCQRz/4cm43/ZG3Cu9ERHEJb4XZClRldgUW+36KSNfXX9k
 2QbVueqxi5k8hEGxgfklNrAw+N0HvDuQEE4ROEPKItMAIc0IARa1yeY5v+eMhWfB
 N98c7w5byWLDW7x7adD6i/wlDNoPl//NEihjeFPFlZPNGr/+my1CaicnQHqAPqSe
 +ezwTIxe/BmQyRken7z2B38H6u2kxQNBfg29LlMeAu1yjls+UM6pz6USyQvJPZiX
 vfftlexSf55modR+8JVBv4yA4vwI8dzCP5U8Xt8wBzT6JLNrRo7H9t8sbiGIlj9s
 KfFEdspR1jRNNZy5mYuDgCtB3+dUHuFtv8HURP3A2XtUTcFKE2nBNXbSm0OAOpay
 p5WwDJO8tMhl8aGf4HWq
 =rl0F
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-4' into staging

minor spice patches.

# gpg: Signature made Mon 10 Mar 2014 13:13:14 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-4:
  configure: Prettify message for hosts without spice support
  spice: QemuUIInfo windup
  spice: fix simple display surface handling

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-11 13:03:22 +00:00
Peter Maydell c57ec3249e input: fixes for the rewrite.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTHbURAAoJEEy22O7T6HE4xRcP/1JMzgSf9tHZiTcHa1kjvshS
 frG3kowPkAm5PmCe02VniYRqcez9ZT5LbEEUvmG8fn6/54Vnjgiz8+oEFllpEeO5
 Y3eU/7uxeXfLSFMXmUJNPQUd4XQJbIq8zHZODsrng27rNH76HZsb5vZaT1ReWq4k
 ozpx3ZAGemKfEsl96xKRwkTw0HnTajH3P2mRYpFodhsAPqB8pH/y2g9ZIEjk/MgG
 QO3bHS0KQpFSF0nFO76JGCLEcH1AjIChNbkIQfYuB64LwS6wXqxGv8kymvrc0DL8
 Mgp0dktpUgWumSB+kjaRePfVCEqY+IbAIo1v4o9skU89szYaB/Byf6eDtLl3TRnE
 6SWOjElkZ7qpgPsBUBFO2oX//YFdC36LpBH7ZcOr7vSm2MjI2BLa87n/wh+lhbTf
 oydWnLY++0zp0F76t+kYZYn/l5LY2/aTN5XF3xGnFvKVyb+lnAbjPHB/LI/0RNHY
 cEzhgiuDdsu/L6NgQJMcO+U+3d7GSNkBkFdRg7llD45UGzp+zQ0dwjq4+gIQYK5u
 UMrByfgpVX5TSMYdC2+CWWEGEGeGcoaly+otV6CE4G341h/BCWlY5Cg+0c2WQoKp
 BXuFkzsNnZxS0t4UQvZP+IeV+PUJf97e389sFVNd/YE+Fajy0Z2BVfRFSxJgfS+L
 8Y6pSJJzvWju67+9aQbX
 =YfEB
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-5' into staging

input: fixes for the rewrite.

# gpg: Signature made Mon 10 Mar 2014 12:50:25 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-input-5:
  input: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves.
  input: sdl: fix guest_cursor logic.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-11 12:52:08 +00:00
Peter Maydell fe6c53b4bb vnc dirty tracking optinizations.
various vnc bugfixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTHbKaAAoJEEy22O7T6HE4zwAP/0Auz/T/Q+r3KQQfAgICFg4F
 wdWUQFi+M9+iub8tR+MAJLxJDGjyT3QQcYk7wyQTbttEHJawlhrHNFZYPlbsPOI1
 VuS/hATioUD815ch5gcuGt8yS7z9YfGwn84yopoge3L6SkW9x9jp/uXLvVe5WzJ1
 +5pGVVKH22aHG7kurrfGuqh1Uofj/GlPy6D5hX3DtLu1WPoTJN53ODwU35qR9j+o
 m1y1kDKN6KXICSDSzieLgSV4P6f4vu9zM3yiArK31tEWR+gBMH1lysoqYWIc+NCG
 R4QQZjDOYGIyXfCAPZJ0iV1wcoep2mPOxF0e+3WwXtBK0yRIFPEHwT5/geTpTsWK
 9+ERRflEYIx5evbw2+LHlW7AAeW7R8HhJggwp4UeWC9grjFNbS86JHsJDQ4Op84k
 oDtr11uG9z+GBCXDOLEe2/1WpPSTnd/K1bMW5x/AvDX8MiVrE67gmErL4GM9WOnC
 C4LRZnfmzqCN4hfBeMoEWuqIekI4Q/5+0f2WRBpWWU5KMV9W6CLR6c9HGI3E/1sx
 21DFzspK+97vG+T/LrmW0WKXTq3ll6H4QaoLDPccH4Pqy9x7FkgWXhWBPhWlTxsH
 Q+gvxW8XhspdyZnjLwovybo65o+JlXZ01eDLIINELr5Gx62MtWdnGUZqbdpH8V7P
 duCaAkU7tpjk9RtBFCN6
 =7t/O
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-1' into staging

vnc dirty tracking optinizations.
various vnc bugfixes.

# gpg: Signature made Mon 10 Mar 2014 12:39:54 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vnc-1:
  ui/vnc: disable adaptive update calculations if not needed
  ui/vnc: optimize setting in vnc_dpy_update()
  ui/vnc: optimize clearing in find_and_clear_dirty_height()
  ui/vnc: optimize dirty bitmap tracking
  ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT
  ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro
  vnc: fix use-after-free in vnc_update_client_sync
  vnc: Fix qemu crashed when vnc client disconnect suddenly
  vnc: Fix tight_detect_smooth_image() for lossless case

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-11 10:53:17 +00:00
Gerd Hoffmann 9b74d0d598 spice: QemuUIInfo windup
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 13:55:25 +01:00
Gerd Hoffmann 4b87dc4c97 spice: fix simple display surface handling
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 13:55:20 +01:00
Gerd Hoffmann dbb2a1326a input: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves.
Unbreaks mouse wheel.

Reported-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 13:49:44 +01:00
Gerd Hoffmann c3aa84b68f input: sdl: fix guest_cursor logic.
Unbreaks relative mouse mode with SDL.

Reported-by: Gabriel L. Somlo <gsomlo@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 13:49:44 +01:00
Peter Lieven e22492d332 ui/vnc: disable adaptive update calculations if not needed
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Peter Lieven 919372251c ui/vnc: optimize setting in vnc_dpy_update()
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Peter Lieven 863d7c9105 ui/vnc: optimize clearing in find_and_clear_dirty_height()
The following artifical test (just the bitmap operation part) running
vnc_update_client 65536 times on a 2560x2048 surface illustrates the
performance difference:

All bits clean - vnc_update_client_new: 0.07 secs
                 vnc_update_client_new2: 0.07 secs
                 vnc_update_client_old: 10.98 secs

All bits dirty - vnc_update_client_new: 11.26 secs
               - vnc_update_client_new2: 0.29 secs
                 vnc_update_client_old: 20.19 secs

Few bits dirty - vnc_update_client_new: 0.07 secs
               - vnc_update_client_new2: 0.07 secs
                 vnc_update_client_old: 10.98 secs

vnc_update_client_new2 shows the performance of vnc_update_client
with this patch added.

Comparing with the test run of the last patch the performance
is at least unchanged while it is significantly improved
for the all bits dirty case.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Peter Lieven 12b316d4c1 ui/vnc: optimize dirty bitmap tracking
vnc_update_client currently scans the dirty bitmap of each client
bitwise which is a very costly operation if only few bits are dirty.
vnc_refresh_server_surface does almost the same.
this patch optimizes both by utilizing the heavily optimized
function find_next_bit to find the offset of the next dirty
bit in the dirty bitmaps.

The following artifical test (just the bitmap operation part) running
vnc_update_client 65536 times on a 2560x2048 surface illustrates the
performance difference:

All bits clean - vnc_update_client_new: 0.07 secs
 vnc_update_client_old: 10.98 secs

All bits dirty - vnc_update_client_new: 11.26 secs
 vnc_update_client_old: 20.19 secs

Few bits dirty - vnc_update_client_new: 0.08 secs
 vnc_update_client_old: 10.98 secs

The case for all bits dirty is still rather slow, this
is due to the implementation of find_and_clear_dirty_height.
This will be addresses in a separate patch.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Peter Lieven 6cd859aa8a ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT
this allows for setting VNC_DIRTY_PIXELS_PER_BIT to different
values than 16 if desired.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Peter Lieven b4c85ddcec ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Gerd Hoffmann 38ee14f4f3 vnc: fix use-after-free in vnc_update_client_sync
Spotted by Coverity:

876     static int vnc_update_client_sync(VncState *vs, int has_dirty)
877     {

(1) Event freed_arg:    "vnc_update_client(VncState *, int)" frees "vs".  [details]
Also see events:        [deref_arg]

878         int ret = vnc_update_client(vs, has_dirty);

(2) Event deref_arg:    Calling "vnc_jobs_join(VncState *)" dereferences freed pointer "vs". [details]
Also see events:        [freed_arg]

879         vnc_jobs_join(vs);
880         return ret;
881     }

Remove vnc_update_client_sync wrapper, replace it with an additional
argument to vnc_update_client, so we can so the sync properly in
vnc_update_client (i.e. skip it in case of a client disconnect).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
2014-03-10 12:35:04 +01:00
Gonglei (Arei) e3c1adf16e vnc: Fix qemu crashed when vnc client disconnect suddenly
Hi,

When I use RealVNC viewer client (http://www.realvnc.com/) to connect vnc server,
the client disconnect suddenly, and I click reconnect button immediately, then the Qemu crashed.

In the function vnc_worker_thread_loop, will call vnc_async_encoding_start
to set the local vs->output buffer by global queue's buffer. Then send rectangles to
the vnc client call function vnc_send_framebuffer_update. Finally, Under normal circumstances,
call vnc_async_encoding_end to set the global queue'buffer by the local vs->output conversely.

When the vnc client disconnect, the job->vs->csock will be set to -1. And the current prcoess
logic will goto disconnected partion without call function vnc_async_encoding_end.
But, the function vnc_send_framebuffer_update will call buffer_reserve, which
maybe call g_realloc reset the local vs's buffer, meaning the global queue's buffer is modified also.
If anyone use the original global queue's buffer memory will cause corruption and then crash qemu.

This patch assure the function vnc_async_encoding_end being called
even though the vnc client disconnect suddenly.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Markus Armbruster 2e7bcdb99a vnc: Fix tight_detect_smooth_image() for lossless case
VncTight member uint8_t quality is either (uint8_t)-1 for lossless or
less than 10 for lossy.

tight_detect_smooth_image() first promotes it to int, then compares
with -1.  Always unequal, so we always execute the lossy code.  Reads
beyond tight_conf[] and returns crap when quality is actually
lossless.

Compare to (uint8_t)-1 instead, like we do elsewhere.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10 12:35:04 +01:00
Dr. David Alan Gilbert 4900116e6f Add a 'name' parameter to qemu_thread_create
If enabled, set the thread name at creation (on GNU systems with
  pthread_set_np)
Fix up all the callers with a thread name

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2014-03-09 21:09:38 +02:00