From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jindrich Makovicka Subject: Re: Mouse motion lags Date: Wed, 7 Jan 2009 00:04:23 +0100 Message-ID: <20090107000423.44925189@holly> References: <7bed83ad0901010905x23d0e745rf74be537cfcfc6d7@mail.gmail.com> <1e16a9ed0901011344y64a16464j4932d4f72cc592e2@mail.gmail.com> <7bed83ad0901011408k261bf1d3g14c6483429a9474@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_//MoQ2aj1_xBPHFt2WvuA6FX" To: kvm@vger.kernel.org Return-path: Received: from main.gmane.org ([80.91.229.2]:42249 "EHLO ciao.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755113AbZAFXEl (ORCPT ); Tue, 6 Jan 2009 18:04:41 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LKKyS-0005e8-Hp for kvm@vger.kernel.org; Tue, 06 Jan 2009 23:04:36 +0000 Received: from 82.208.33.94 ([82.208.33.94]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 06 Jan 2009 23:04:36 +0000 Received: from makovick by 82.208.33.94 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 06 Jan 2009 23:04:36 +0000 In-Reply-To: <7bed83ad0901011408k261bf1d3g14c6483429a9474@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: --MP_//MoQ2aj1_xBPHFt2WvuA6FX Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, 2 Jan 2009 00:08:27 +0200 "Volodymyr Buell" wrote: > On Thu, Jan 1, 2009 at 11:44 PM, Todd Deshane > wrote: > > On Thu, Jan 1, 2009 at 12:05 PM, Volodymyr Buell > > 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 --MP_//MoQ2aj1_xBPHFt2WvuA6FX Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=sdl.c.diff --- 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) --MP_//MoQ2aj1_xBPHFt2WvuA6FX--