Slowdown SDL while minimized
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. (Samuel Thibault) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4050 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
4c44bdcb70
commit
f442e08b41
|
@ -71,6 +71,7 @@ struct DisplayState {
|
||||||
int height;
|
int height;
|
||||||
void *opaque;
|
void *opaque;
|
||||||
struct QEMUTimer *gui_timer;
|
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_update)(struct DisplayState *s, int x, int y, int w, int h);
|
||||||
void (*dpy_resize)(struct DisplayState *s, int w, int h);
|
void (*dpy_resize)(struct DisplayState *s, int w, int h);
|
||||||
|
|
9
sdl.c
9
sdl.c
|
@ -510,6 +510,15 @@ static void sdl_refresh(DisplayState *ds)
|
||||||
!ev->active.gain && !gui_fullscreen_initial_grab) {
|
!ev->active.gain && !gui_fullscreen_initial_grab) {
|
||||||
sdl_grab_end();
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
6
vl.c
6
vl.c
|
@ -7208,7 +7208,11 @@ static void gui_update(void *opaque)
|
||||||
{
|
{
|
||||||
DisplayState *ds = opaque;
|
DisplayState *ds = opaque;
|
||||||
ds->dpy_refresh(ds);
|
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 {
|
struct vm_change_state_entry {
|
||||||
|
|
Loading…
Reference in a new issue