aboutsummaryrefslogtreecommitdiff
path: root/vnc.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-01-13 23:51:53 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-01-13 23:51:53 +0000
commita0ecfb73b196147215a621236bc7ad8f500b95ea (patch)
treebfb6bfaf1b8f39f98dfa4124e1362fc6f1a5cda7 /vnc.c
parent8fccda832a6cb634daf409e75583b18413e919e9 (diff)
Reduce redundant timer ticks in VNC, by Anders Melchiorsen.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3904 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vnc.c')
-rw-r--r--vnc.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/vnc.c b/vnc.c
index 9fb8c85a1a..b5921a3122 100644
--- a/vnc.c
+++ b/vnc.c
@@ -506,6 +506,8 @@ static void vnc_update_client(void *opaque)
int saved_offset;
int has_dirty = 0;
+ vga_hw_update();
+
vnc_set_bits(width_mask, (vs->width / 16), VNC_DIRTY_WORDS);
/* Walk through the dirty map and eliminate tiles that
@@ -580,22 +582,11 @@ static void vnc_update_client(void *opaque)
vnc_flush(vs);
}
- qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
-}
-static void vnc_timer_init(VncState *vs)
-{
- if (vs->timer == NULL) {
- vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);
- qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock));
+ if (vs->csock != -1) {
+ qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
}
-}
-static void vnc_dpy_refresh(DisplayState *ds)
-{
- VncState *vs = ds->opaque;
- vnc_timer_init(vs);
- vga_hw_update();
}
static int vnc_listen_poll(void *opaque)
@@ -1926,6 +1917,7 @@ static void vnc_listen_read(void *opaque)
vs->has_resize = 0;
vs->has_hextile = 0;
vs->ds->dpy_copy = NULL;
+ vnc_update_client(vs);
}
}
@@ -1959,10 +1951,12 @@ void vnc_display_init(DisplayState *ds)
if (!vs->kbd_layout)
exit(1);
+ vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);
+
vs->ds->data = NULL;
vs->ds->dpy_update = vnc_dpy_update;
vs->ds->dpy_resize = vnc_dpy_resize;
- vs->ds->dpy_refresh = vnc_dpy_refresh;
+ vs->ds->dpy_refresh = NULL;
memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));