ioemu: Slown down refresh interval when SDL is minimized
PATCH 1/1 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 <[email protected]>
tools/ioemu/sdl.c +9 -0
@@ -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 ;
tools/ioemu/vl.c +5 -1
@@ -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 {
tools/ioemu/vl.h +1 -0
@@ -935,6 +935,7 @@ struct DisplayState {int width;int height;void *opaque; +uint64_t gui_timer_interval;int switchbpp;int shared_buf;