qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul)
@ 2014-08-06 22:22 Benedikt Morbach
  2014-08-07 21:58 ` Benedikt Morbach
  2014-08-25 13:51 ` [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul) Gerd Hoffmann
  0 siblings, 2 replies; 4+ messages in thread
From: Benedikt Morbach @ 2014-08-06 22:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

I think one of those gtk patches broke mouse/keyboard grab for my
Windows 8 vfio/vga-passthrough setup in 2.1.0 and I was instructed on
IRC to report that here.

With 2.0.0 I got a black qemu window with "This VM has no graphic
display device", which I could click on to get a mouse grab.
With 2.1.0 I just get the qemu monitor window.
If I press Ctrl-Alt-g or use the corresponding menu entry, the gtk
window grabs the input devices and the titlebar changes to "press
Ctrl-Alt-g to release grab", but none of the input reaches the vm.

I tried all of {gtk3, sdl} x {usb-mouse, usb-tablet}:
With gtk3, none worked.
With sdl usb-tablet worked, but I haven't figured out how to do an
actual mouse grab. (maybe related to me passing "-vga none"?)

If I drop the "-vga none" I can get a mouse-grab, but the passed-through
gpu won't work, so this is no option for me.

If needed I can produce some logs with both 2.0 and 2.1, but I don't
know what options I should pass to qemu to make those useful.

Here is how I start qemu:
qemu-system-x86_64
    -enable-kvm -M q35  -cpu host,hv-time,kvm=off -vga none
    -m 8192 -smp 2,sockets=1,cores=2,threads=1
    -bios /usr/share/qemu/bios.bin
    -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
    -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
    -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1
    -drive file=/mnt/images/Win8.raw,id=disk,format=raw,if=virtio
    -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id=sound0
    -device hda-micro,id=sound0-codec0,bus=sound0.0,cad=0 
    -net bridge -net nic,model=virtio
    -rtc base=localtime
    -usb
    -usbdevice mouse
    -usbdevice keyboard

Greetings,
Benedikt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul)
  2014-08-06 22:22 [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul) Benedikt Morbach
@ 2014-08-07 21:58 ` Benedikt Morbach
  2014-08-13  1:19   ` [Qemu-devel] [PATCH] fix gtk interface for vfio + vga=none (was: Mousegrab broken with vfio in 2.1.0) Benedikt Morbach
  2014-08-25 13:51 ` [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul) Gerd Hoffmann
  1 sibling, 1 reply; 4+ messages in thread
From: Benedikt Morbach @ 2014-08-07 21:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

On Thu, 2014-08-07 at 00:22 +0200, Benedikt Morbach wrote:
> I think one of those gtk patches broke mouse/keyboard grab for my
> Windows 8 vfio/vga-passthrough setup in 2.1.0 and I was instructed on
> IRC to report that here.
> 
> With 2.0.0 I got a black qemu window with "This VM has no graphic
> display device", which I could click on to get a mouse grab.
> With 2.1.0 I just get the qemu monitor window.
> If I press Ctrl-Alt-g or use the corresponding menu entry, the gtk
> window grabs the input devices and the titlebar changes to "press
> Ctrl-Alt-g to release grab", but none of the input reaches the vm.
> 
> I tried all of {gtk3, sdl} x {usb-mouse, usb-tablet}:
> With gtk3, none worked.
> With sdl usb-tablet worked, but I haven't figured out how to do an
> actual mouse grab. (maybe related to me passing "-vga none"?)
> 
> If I drop the "-vga none" I can get a mouse-grab, but the passed-through
> gpu won't work, so this is no option for me.
> 
> If needed I can produce some logs with both 2.0 and 2.1, but I don't
> know what options I should pass to qemu to make those useful.
> 
> Here is how I start qemu:
> qemu-system-x86_64
>     -enable-kvm -M q35  -cpu host,hv-time,kvm=off -vga none
>     -m 8192 -smp 2,sockets=1,cores=2,threads=1
>     -bios /usr/share/qemu/bios.bin
>     -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
>     -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
>     -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1
>     -drive file=/mnt/images/Win8.raw,id=disk,format=raw,if=virtio
>     -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id=sound0
>     -device hda-micro,id=sound0-codec0,bus=sound0.0,cad=0 
>     -net bridge -net nic,model=virtio
>     -rtc base=localtime
>     -usb
>     -usbdevice mouse
>     -usbdevice keyboard

I have now bisected this down to:

commit ed1132e41a31ded554adc542ddf043714f05b9d0                                                                                                                                                                                                

    gtk: support multiple gfx displays

    Each display gets its own tab.  Tab switching continues to work like it
    did, just the hotkeys of the vte consoles changes in case a secondary
    display is present as it will get ctrl-alt-2 assigned and the vtes are
    shifted by one.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH] fix gtk interface for vfio + vga=none (was: Mousegrab broken with vfio in 2.1.0)
  2014-08-07 21:58 ` Benedikt Morbach
@ 2014-08-13  1:19   ` Benedikt Morbach
  0 siblings, 0 replies; 4+ messages in thread
From: Benedikt Morbach @ 2014-08-13  1:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

after the recent ui rework it didn't show a gfx window if no emulated
graphics card was attached. This prevented input grab from working for
the vfio gpu passthrough use case.

Hack around this by always creating at least one gfx tab.
---

I'm not quite sure how much of a hack this is, but it at least matches
the old behaviour of creating at least one gfx console and works for me.
So if anyone wants to give this a shot until someone comes up with a
proper fix, here it is.


 ui/gtk.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 2345d7e..4251fd3 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1639,9 +1639,11 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
     Error *local_err = NULL;
     Object *obj;
 
-    obj = object_property_get_link(OBJECT(con), "device", &local_err);
-    if (obj) {
-        vc->label = g_strdup_printf("%s", object_get_typename(obj));
+    if (con) {
+        obj = object_property_get_link(OBJECT(con), "device", &local_err);
+        if (obj) {
+            vc->label = g_strdup_printf("%s", object_get_typename(obj));
+        }
     } else {
         vc->label = g_strdup_printf("VGA");
     }
@@ -1742,7 +1744,7 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
     /* gfx */
     for (vc = 0;; vc++) {
         con = qemu_console_lookup_by_index(vc);
-        if (!con || !qemu_console_is_graphic(con)) {
+        if (vc > 0 && (!con || !qemu_console_is_graphic(con))) {
             break;
         }
         group = gd_vc_gfx_init(s, &s->vc[vc], con,
-- 
2.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul)
  2014-08-06 22:22 [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul) Benedikt Morbach
  2014-08-07 21:58 ` Benedikt Morbach
@ 2014-08-25 13:51 ` Gerd Hoffmann
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-08-25 13:51 UTC (permalink / raw)
  To: Benedikt Morbach; +Cc: qemu-devel

On Do, 2014-08-07 at 00:22 +0200, Benedikt Morbach wrote:
> I think one of those gtk patches broke mouse/keyboard grab for my
> Windows 8 vfio/vga-passthrough setup in 2.1.0 and I was instructed on
> IRC to report that here.
> 
> With 2.0.0 I got a black qemu window with "This VM has no graphic
> display device", which I could click on to get a mouse grab.

Yes, this is (intentionally) gone in 2.1.
No vga -> no graphic display.

> If I press Ctrl-Alt-g or use the corresponding menu entry, the gtk
> window grabs the input devices and the titlebar changes to "press
> Ctrl-Alt-g to release grab", but none of the input reaches the vm.

It shouldn't allow the grab in the first place.

But, yes, any input (grab being active or not) is only routed to the
guest in case a graphic display tab is the active one.  You don't want
the guest see the stuff you are typing into the qemu monitor.

> If I drop the "-vga none" I can get a mouse-grab, but the passed-through
> gpu won't work, so this is no option for me.

Worth trying: '-vga none -device secondary-vga'.


How does your setup look like?  Two gfx cards, one for the host, one for
the guest?  Then have qemu running on the host display, let qemu grab
the input and feed mouse (kbd too?) input to the guest that way?

It's a bit strange, but I think we don't have a better way to do it
(without additional physical devices).  In case you have a spare usb
mouse you can simply plug it in and use usb-host to assign it to the
guest, which is probably more comfortable than grabbing/ungrabbing when
switching between host and guest.


cheers,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-25 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-06 22:22 [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul) Benedikt Morbach
2014-08-07 21:58 ` Benedikt Morbach
2014-08-13  1:19   ` [Qemu-devel] [PATCH] fix gtk interface for vfio + vga=none (was: Mousegrab broken with vfio in 2.1.0) Benedikt Morbach
2014-08-25 13:51 ` [Qemu-devel] Mousegrab broken with vfio in 2.1.0 (was: [PATCH 00/25] qemu gtk ui overhaul) Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).