summaryrefslogtreecommitdiff
path: root/ui/console.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-03-14 11:56:16 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-04-16 09:03:49 +0200
commit0f7b2864d0d0c3ef2801f9214d8c510c80a220d1 (patch)
tree2223119758f09c83a125f6335c483618910e8569 /ui/console.c
parent380cd056ec0e7fc8bbd553cdcb061d3ca612bb82 (diff)
downloadqemu-0f7b2864d0d0c3ef2801f9214d8c510c80a220d1.tar.gz
console: gui timer fixes
Make gui update rate adaption code in gui_update() actually work. Sprinkle in a tracepoint so you can see the code at work. Remove the update rate adaption code in vnc and make vnc simply use the generic bits instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/console.c')
-rw-r--r--ui/console.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/ui/console.c b/ui/console.c
index 79a306be8c..5bbc891f25 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -157,6 +157,9 @@ struct QemuConsole {
struct DisplayState {
struct QEMUTimer *gui_timer;
+ uint64_t last_update;
+ uint64_t update_interval;
+ bool refreshing;
bool have_gfx;
bool have_text;
@@ -171,22 +174,32 @@ static int nb_consoles = 0;
static void text_console_do_init(CharDriverState *chr, DisplayState *ds);
static void dpy_gfx_switch_surface(DisplayState *ds,
DisplaySurface *surface);
+static void dpy_refresh(DisplayState *s);
static void gui_update(void *opaque)
{
- uint64_t interval = GUI_REFRESH_INTERVAL;
+ uint64_t interval = GUI_REFRESH_INTERVAL_IDLE;
+ uint64_t dcl_interval;
DisplayState *ds = opaque;
DisplayChangeListener *dcl;
+ ds->refreshing = true;
dpy_refresh(ds);
+ ds->refreshing = false;
QLIST_FOREACH(dcl, &ds->listeners, next) {
- if (dcl->gui_timer_interval &&
- dcl->gui_timer_interval < interval) {
- interval = dcl->gui_timer_interval;
+ dcl_interval = dcl->update_interval ?
+ dcl->update_interval : GUI_REFRESH_INTERVAL_DEFAULT;
+ if (interval > dcl_interval) {
+ interval = dcl_interval;
}
}
- qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock));
+ if (ds->update_interval != interval) {
+ ds->update_interval = interval;
+ trace_console_refresh(interval);
+ }
+ ds->last_update = qemu_get_clock_ms(rt_clock);
+ qemu_mod_timer(ds->gui_timer, ds->last_update + interval);
}
static void gui_setup_refresh(DisplayState *ds)
@@ -1286,6 +1299,17 @@ void register_displaychangelistener(DisplayState *ds,
}
}
+void update_displaychangelistener(DisplayChangeListener *dcl,
+ uint64_t interval)
+{
+ DisplayState *ds = dcl->ds;
+
+ dcl->update_interval = interval;
+ if (!ds->refreshing && ds->update_interval > interval) {
+ qemu_mod_timer(ds->gui_timer, ds->last_update + interval);
+ }
+}
+
void unregister_displaychangelistener(DisplayChangeListener *dcl)
{
DisplayState *ds = dcl->ds;