On Fri, 2 Jan 2009 00:08:27 +0200
"Volodymyr Buell" <[email protected]> wrote:

> On Thu, Jan 1, 2009 at 11:44 PM, Todd Deshane <[email protected]>
> wrote:
> > On Thu, Jan 1, 2009 at 12:05 PM, Volodymyr Buell <[email protected]>
> > wrote:
> >> Hi everybody,
> >>
> >> I switched to KVM some time ago from vmware and VB. Everything
> >> works great but there are noticeable lags in mouse motion in
> >> comparison with other VMs.
> >> Is this a known issue? Are there any optimizations for that?
> >>
> >> KVM: 79
> >> Distr: Ubuntu Intrepid & Jaunty
> >> Command line: QEMU_AUDIO_DRV=sdl; kvm -net nic -net user -soundhw
> >> es1370 -m 750 -smp 2 win.qcow
> >>
> >
> > Try adding -usb -usbdevice tablet
> >
> > Hope that helps.
> 
> Unfortunately it brings yet more laggy result. It looks like mouse
> filtering in first person action games but again with the delay I
> mentioned before it's nearly unusable...

You can try the attached patch - it shortens the screen update interval
when the mouse moves. It's just a proof of concept and a little bit
ugly, but should work.

I once tried to submit something similar to QEMU upstream, when the
screen update interval was still hardcoded, but the patch wasn't
accepted. There could be some chance now when the update interval is
already dynamic so the modification is trivial.

-- 
Jindrich Makovicka
--- sdl.c.orig	2008-12-24 15:24:58.000000000 +0100
+++ sdl.c	2009-01-06 23:53:26.282639309 +0100
@@ -356,6 +356,7 @@
     SDL_Event ev1, *ev = &ev1;
     int mod_state;
     int buttonstate = SDL_GetMouseState(NULL, NULL);
+    int moved = 0;
 
     if (last_vm_running != vm_running) {
         last_vm_running = vm_running;
@@ -484,6 +485,7 @@
                 absolute_enabled) {
                 sdl_send_mouse_event(ev->motion.xrel, ev->motion.yrel, 0,
                        ev->motion.x, ev->motion.y, ev->motion.state);
+		moved = 1;
             }
             break;
         case SDL_MOUSEBUTTONDOWN:
@@ -536,6 +538,10 @@
             break;
         }
     }
+    if (moved && ds->gui_timer_interval == 0)
+	ds->gui_timer_interval = 10;
+    else if (!moved && ds->gui_timer_interval == 10)
+	ds->gui_timer_interval = 0;
 }
 
 static void sdl_fill(DisplayState *ds, int x, int y, int w, int h, uint32_t c)

Reply via email to