Don't refresh a graphical screen when it isn't displayed, by Herve Poussineau.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2961 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2007-06-08 01:57:56 +00:00
parent 4fdcd8d43e
commit 740733bb93
2 changed files with 11 additions and 35 deletions

45
vl.c
View File

@ -153,7 +153,6 @@ int ram_size;
int pit_min_timer_count = 0; int pit_min_timer_count = 0;
int nb_nics; int nb_nics;
NICInfo nd_table[MAX_NICS]; NICInfo nd_table[MAX_NICS];
QEMUTimer *gui_timer;
int vm_running; int vm_running;
int rtc_utc = 1; int rtc_utc = 1;
int cirrus_vga_enabled = 1; int cirrus_vga_enabled = 1;
@ -4480,32 +4479,6 @@ void pcmcia_info(void)
"Empty"); "Empty");
} }
/***********************************************************/
/* dumb display */
static void dumb_update(DisplayState *ds, int x, int y, int w, int h)
{
}
static void dumb_resize(DisplayState *ds, int w, int h)
{
}
static void dumb_refresh(DisplayState *ds)
{
vga_hw_update();
}
void dumb_display_init(DisplayState *ds)
{
ds->data = NULL;
ds->linesize = 0;
ds->depth = 0;
ds->dpy_update = dumb_update;
ds->dpy_resize = dumb_resize;
ds->dpy_refresh = dumb_refresh;
}
/***********************************************************/ /***********************************************************/
/* I/O handling */ /* I/O handling */
@ -6198,8 +6171,9 @@ QEMUMachine *find_machine(const char *name)
void gui_update(void *opaque) void gui_update(void *opaque)
{ {
display_state.dpy_refresh(&display_state); DisplayState *ds = opaque;
qemu_mod_timer(gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); ds->dpy_refresh(ds);
qemu_mod_timer(ds->gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock));
} }
struct vm_change_state_entry { struct vm_change_state_entry {
@ -7899,17 +7873,16 @@ int main(int argc, char **argv)
init_ioports(); init_ioports();
/* terminal init */ /* terminal init */
memset(&display_state, 0, sizeof(display_state));
if (nographic) { if (nographic) {
dumb_display_init(ds); /* nothing to do */
} else if (vnc_display != NULL) { } else if (vnc_display != NULL) {
vnc_display_init(ds, vnc_display); vnc_display_init(ds, vnc_display);
} else { } else {
#if defined(CONFIG_SDL) #if defined(CONFIG_SDL)
sdl_display_init(ds, full_screen, no_frame); sdl_display_init(ds, full_screen, no_frame);
#elif defined(CONFIG_COCOA) #elif defined(CONFIG_COCOA)
cocoa_display_init(ds, full_screen); cocoa_display_init(ds, full_screen);
#else
dumb_display_init(ds);
#endif #endif
} }
@ -7977,8 +7950,10 @@ int main(int argc, char **argv)
} }
} }
gui_timer = qemu_new_timer(rt_clock, gui_update, NULL); if (display_state.dpy_refresh) {
qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock)); display_state.gui_timer = qemu_new_timer(rt_clock, gui_update, &display_state);
qemu_mod_timer(display_state.gui_timer, qemu_get_clock(rt_clock));
}
#ifdef CONFIG_GDBSTUB #ifdef CONFIG_GDBSTUB
if (use_gdbstub) { if (use_gdbstub) {

1
vl.h
View File

@ -914,6 +914,7 @@ struct DisplayState {
int width; int width;
int height; int height;
void *opaque; void *opaque;
QEMUTimer *gui_timer;
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);