Samuel Thibault
2008-Mar-04 15:38 UTC
[Xen-devel] [PATCH] ioemu: Slown down refresh interval when SDL is minimized
ioemu: Slown down refresh interval when SDL is minimized as that saves us the VGA refresh scanning. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> diff -r c6cd384a48bf tools/ioemu/sdl.c --- a/tools/ioemu/sdl.c Tue Mar 04 12:32:31 2008 +0000 +++ b/tools/ioemu/sdl.c Tue Mar 04 15:34:25 2008 +0000 @@ -515,6 +515,15 @@ static void sdl_refresh(DisplayState *ds !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; diff -r c6cd384a48bf tools/ioemu/vl.c --- a/tools/ioemu/vl.c Tue Mar 04 12:32:31 2008 +0000 +++ b/tools/ioemu/vl.c Tue Mar 04 15:34:25 2008 +0000 @@ -6125,7 +6125,11 @@ void gui_update(void *opaque) void gui_update(void *opaque) { display_state.dpy_refresh(&display_state); - qemu_mod_timer(gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); + qemu_mod_timer(gui_timer, + (display_state.gui_timer_interval ? + display_state.gui_timer_interval : + GUI_REFRESH_INTERVAL) + + qemu_get_clock(rt_clock)); } struct vm_change_state_entry { diff -r c6cd384a48bf tools/ioemu/vl.h --- a/tools/ioemu/vl.h Tue Mar 04 12:32:31 2008 +0000 +++ b/tools/ioemu/vl.h Tue Mar 04 15:34:25 2008 +0000 @@ -935,6 +935,7 @@ struct DisplayState { int width; int height; void *opaque; + uint64_t gui_timer_interval; int switchbpp; int shared_buf; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel