From: Anders <mail@flac.kalibalik.dk>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4] Reduce redundant timer rearming
Date: Sun, 16 Dec 2007 16:46:37 +0100 [thread overview]
Message-ID: <4765485D.9070501@flac.kalibalik.dk> (raw)
In-Reply-To: <4761C8C7.1030202@flac.kalibalik.dk>
[-- Attachment #1: Type: text/plain, Size: 384 bytes --]
The VNC output runs two 33 Hz timers, one for calling vga_hw_update() in
dpy_refresh (from vl.c), and another for calling vnc_update_client().
This patch moves the vga_hw_update() call into vnc_update_client(),
removing the need for the dpy_refresh timer.
It also makes the remaining timer only fire when a client is actually
connected to the VNC server.
Best regards,
Anders.
[-- Attachment #2: qemu-dynamic-vnc-refresh.diff --]
[-- Type: text/x-patch, Size: 1569 bytes --]
--- a/qemu/vnc.c
+++ b/qemu/vnc.c
@@ -493,6 +493,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
@@ -566,22 +568,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)
@@ -1890,6 +1881,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);
}
}
@@ -1923,10 +1915,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));
prev parent reply other threads:[~2007-12-16 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 23:03 [Qemu-devel] [PATCH] Reduce redundant timer rearming Anders
2007-12-13 23:17 ` Anders Melchiorsen
2007-12-13 23:29 ` [Qemu-devel] [PATCH 2] " Anders
2007-12-14 0:05 ` [Qemu-devel] [PATCH 3] " Anders
2007-12-16 15:46 ` Anders [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4765485D.9070501@flac.kalibalik.dk \
--to=mail@flac.kalibalik.dk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.