diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-11-01 11:14:39 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-11-01 11:14:39 -0500 |
commit | 4ba79505f43bd0ace35c3fe42197eb02e7e0478e (patch) | |
tree | eb1ecd216c1134a88ac0e2d3bc7185319c82fb95 /vl.c | |
parent | d971919f08ca300e7b3595a4c5ddaea2ce8fc3ba (diff) | |
parent | 64f735920ad319aee860e56bb9bad6cfccf4ad40 (diff) |
Merge remote-tracking branch 'kraxel/pixman.v3' into staging
* kraxel/pixman.v3: (22 commits)
pixman: drop obsolete fields from DisplaySurface
pixman/vnc: remove dead code.
pixman/vnc: remove rgb_prepare_row* functions
pixman/vnc: use pixman images in vnc.
pixman: switch screendump function.
vga: stop direct access to DisplaySurface fields.
qxl: stop direct access to DisplaySurface fields.
console: don't set PixelFormat alpha fields for 32bpp
console: make qemu_alloc_display static
pixman: add pixman image to DisplaySurface
pixman: helper functions
pixman: windup in configure & makefiles
pixman: add submodule
console: remove DisplayAllocator
console: remove dpy_gfx_fill
vga: fix text mode updating
console: init displaychangelisteners on register
console: untangle gfx & txt updates
console: s/TextConsole/QemuConsole/
console: move set_mouse + cursor_define callbacks
...
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 49 |
1 files changed, 35 insertions, 14 deletions
@@ -1359,19 +1359,51 @@ static void gui_update(void *opaque) { uint64_t interval = GUI_REFRESH_INTERVAL; DisplayState *ds = opaque; - DisplayChangeListener *dcl = ds->listeners; + DisplayChangeListener *dcl; dpy_refresh(ds); - while (dcl != NULL) { + QLIST_FOREACH(dcl, &ds->listeners, next) { if (dcl->gui_timer_interval && dcl->gui_timer_interval < interval) interval = dcl->gui_timer_interval; - dcl = dcl->next; } qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock)); } +void gui_setup_refresh(DisplayState *ds) +{ + DisplayChangeListener *dcl; + bool need_timer = false; + bool have_gfx = false; + bool have_text = false; + + QLIST_FOREACH(dcl, &ds->listeners, next) { + if (dcl->dpy_refresh != NULL) { + need_timer = true; + } + if (dcl->dpy_gfx_update != NULL) { + have_gfx = true; + } + if (dcl->dpy_text_update != NULL) { + have_text = true; + } + } + + if (need_timer && ds->gui_timer == NULL) { + ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); + qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); + } + if (!need_timer && ds->gui_timer != NULL) { + qemu_del_timer(ds->gui_timer); + qemu_free_timer(ds->gui_timer); + ds->gui_timer = NULL; + } + + ds->have_gfx = have_gfx; + ds->have_text = have_text; +} + struct vm_change_state_entry { VMChangeStateHandler *cb; void *opaque; @@ -2450,7 +2482,6 @@ int main(int argc, char **argv, char **envp) const char *kernel_filename, *kernel_cmdline; char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */ DisplayState *ds; - DisplayChangeListener *dcl; int cyls, heads, secs, translation; QemuOpts *hda_opts = NULL, *opts, *machine_opts; QemuOptsList *olist; @@ -3873,16 +3904,6 @@ int main(int argc, char **argv, char **envp) #endif /* display setup */ - dpy_resize(ds); - dcl = ds->listeners; - while (dcl != NULL) { - if (dcl->dpy_refresh != NULL) { - ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); - qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); - break; - } - dcl = dcl->next; - } text_consoles_set_display(ds); if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) { |