From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZ2QU-0004gh-NU for qemu-devel@nongnu.org; Tue, 11 Mar 2008 07:13:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZ2QT-0004gV-NN for qemu-devel@nongnu.org; Tue, 11 Mar 2008 07:13:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZ2QT-0004gS-KB for qemu-devel@nongnu.org; Tue, 11 Mar 2008 07:13:45 -0400 Received: from smtp02.citrix.com ([66.165.176.63]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JZ2QT-0007Ht-80 for qemu-devel@nongnu.org; Tue, 11 Mar 2008 07:13:45 -0400 Received: from implementation.famille.thibault.fr (dhcp-16-192.uk.xensource.com [172.31.16.192]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m2BBCweq009263 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 11 Mar 2008 04:13:01 -0700 Received: from samy by implementation.famille.thibault.fr with local (Exim 4.69) (envelope-from ) id 1JZ2Pb-0001Xg-R6 for qemu-devel@nongnu.org; Tue, 11 Mar 2008 12:12:52 +0100 Date: Tue, 11 Mar 2008 11:12:51 +0000 From: Samuel Thibault Message-ID: <20080311111251.GA5831@implementation.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Slowdown SDL while minimized Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org When SDL is invisible/minimized, there is no need to keep calling the VGA refresh 33 times per second. This patch reduces in that case the rate to 2 times per second, which should be responsive enough for the un-minimizing event. Index: console.h =================================================================== RCS file: /sources/qemu/qemu/console.h,v retrieving revision 1.2 diff -u -p -r1.2 console.h --- console.h 10 Feb 2008 16:33:13 -0000 1.2 +++ console.h 11 Mar 2008 11:05:08 -0000 @@ -71,6 +71,7 @@ int height; void *opaque; struct QEMUTimer *gui_timer; + uint64_t gui_timer_interval; void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); void (*dpy_resize)(struct DisplayState *s, int w, int h); Index: sdl.c =================================================================== RCS file: /sources/qemu/qemu/sdl.c,v retrieving revision 1.46 --- sdl.c 10 Mar 2008 19:34:27 -0000 1.46 +++ sdl.c 11 Mar 2008 11:05:08 -0000 @@ -506,6 +506,15 @@ !ev->active.gain && !gui_fullscreen_initial_grab) { sdl_grab_end(); } + if (ev->active.state & SDL_APPACTIVE) { + if (ev->active.gain) { + /* Back to default interval */ + ds->gui_timer_interval = 0; + } else { + /* Sleeping interval */ + ds->gui_timer_interval = 500; + } + } break; default: break; Index: vl.c =================================================================== RCS file: /sources/qemu/qemu/vl.c,v retrieving revision 1.410 --- vl.c 10 Mar 2008 19:34:27 -0000 1.410 +++ vl.c 11 Mar 2008 11:05:09 -0000 @@ -7208,7 +7200,11 @@ { DisplayState *ds = opaque; ds->dpy_refresh(ds); - qemu_mod_timer(ds->gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); + qemu_mod_timer(ds->gui_timer, + (ds->gui_timer_interval ? + ds->gui_timer_interval : + GUI_REFRESH_INTERVAL) + + qemu_get_clock(rt_clock)); } struct vm_change_state_entry {