Commit 740733bb939963e77dacda0367eb807dea1c4faf
1 parent
4fdcd8d4
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
Showing
2 changed files
with
11 additions
and
35 deletions
vl.c
| ... | ... | @@ -153,7 +153,6 @@ int ram_size; |
| 153 | 153 | int pit_min_timer_count = 0; |
| 154 | 154 | int nb_nics; |
| 155 | 155 | NICInfo nd_table[MAX_NICS]; |
| 156 | -QEMUTimer *gui_timer; | |
| 157 | 156 | int vm_running; |
| 158 | 157 | int rtc_utc = 1; |
| 159 | 158 | int cirrus_vga_enabled = 1; |
| ... | ... | @@ -4481,32 +4480,6 @@ void pcmcia_info(void) |
| 4481 | 4480 | } |
| 4482 | 4481 | |
| 4483 | 4482 | /***********************************************************/ |
| 4484 | -/* dumb display */ | |
| 4485 | - | |
| 4486 | -static void dumb_update(DisplayState *ds, int x, int y, int w, int h) | |
| 4487 | -{ | |
| 4488 | -} | |
| 4489 | - | |
| 4490 | -static void dumb_resize(DisplayState *ds, int w, int h) | |
| 4491 | -{ | |
| 4492 | -} | |
| 4493 | - | |
| 4494 | -static void dumb_refresh(DisplayState *ds) | |
| 4495 | -{ | |
| 4496 | - vga_hw_update(); | |
| 4497 | -} | |
| 4498 | - | |
| 4499 | -void dumb_display_init(DisplayState *ds) | |
| 4500 | -{ | |
| 4501 | - ds->data = NULL; | |
| 4502 | - ds->linesize = 0; | |
| 4503 | - ds->depth = 0; | |
| 4504 | - ds->dpy_update = dumb_update; | |
| 4505 | - ds->dpy_resize = dumb_resize; | |
| 4506 | - ds->dpy_refresh = dumb_refresh; | |
| 4507 | -} | |
| 4508 | - | |
| 4509 | -/***********************************************************/ | |
| 4510 | 4483 | /* I/O handling */ |
| 4511 | 4484 | |
| 4512 | 4485 | #define MAX_IO_HANDLERS 64 |
| ... | ... | @@ -6198,8 +6171,9 @@ QEMUMachine *find_machine(const char *name) |
| 6198 | 6171 | |
| 6199 | 6172 | void gui_update(void *opaque) |
| 6200 | 6173 | { |
| 6201 | - display_state.dpy_refresh(&display_state); | |
| 6202 | - qemu_mod_timer(gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); | |
| 6174 | + DisplayState *ds = opaque; | |
| 6175 | + ds->dpy_refresh(ds); | |
| 6176 | + qemu_mod_timer(ds->gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); | |
| 6203 | 6177 | } |
| 6204 | 6178 | |
| 6205 | 6179 | struct vm_change_state_entry { |
| ... | ... | @@ -7899,17 +7873,16 @@ int main(int argc, char **argv) |
| 7899 | 7873 | init_ioports(); |
| 7900 | 7874 | |
| 7901 | 7875 | /* terminal init */ |
| 7876 | + memset(&display_state, 0, sizeof(display_state)); | |
| 7902 | 7877 | if (nographic) { |
| 7903 | - dumb_display_init(ds); | |
| 7878 | + /* nothing to do */ | |
| 7904 | 7879 | } else if (vnc_display != NULL) { |
| 7905 | - vnc_display_init(ds, vnc_display); | |
| 7880 | + vnc_display_init(ds, vnc_display); | |
| 7906 | 7881 | } else { |
| 7907 | 7882 | #if defined(CONFIG_SDL) |
| 7908 | 7883 | sdl_display_init(ds, full_screen, no_frame); |
| 7909 | 7884 | #elif defined(CONFIG_COCOA) |
| 7910 | 7885 | cocoa_display_init(ds, full_screen); |
| 7911 | -#else | |
| 7912 | - dumb_display_init(ds); | |
| 7913 | 7886 | #endif |
| 7914 | 7887 | } |
| 7915 | 7888 | |
| ... | ... | @@ -7977,8 +7950,10 @@ int main(int argc, char **argv) |
| 7977 | 7950 | } |
| 7978 | 7951 | } |
| 7979 | 7952 | |
| 7980 | - gui_timer = qemu_new_timer(rt_clock, gui_update, NULL); | |
| 7981 | - qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock)); | |
| 7953 | + if (display_state.dpy_refresh) { | |
| 7954 | + display_state.gui_timer = qemu_new_timer(rt_clock, gui_update, &display_state); | |
| 7955 | + qemu_mod_timer(display_state.gui_timer, qemu_get_clock(rt_clock)); | |
| 7956 | + } | |
| 7982 | 7957 | |
| 7983 | 7958 | #ifdef CONFIG_GDBSTUB |
| 7984 | 7959 | if (use_gdbstub) { | ... | ... |
vl.h
| ... | ... | @@ -914,6 +914,7 @@ struct DisplayState { |
| 914 | 914 | int width; |
| 915 | 915 | int height; |
| 916 | 916 | void *opaque; |
| 917 | + QEMUTimer *gui_timer; | |
| 917 | 918 | |
| 918 | 919 | void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); |
| 919 | 920 | void (*dpy_resize)(struct DisplayState *s, int w, int h); | ... | ... |