From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 3/3] vnc: throttle screen updates.
Date: Fri, 20 Mar 2009 12:31:29 +0100 [thread overview]
Message-ID: <1237548689-8677-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1237548689-8677-1-git-send-email-kraxel@redhat.com>
This patch makes the vnc server code skip screen refreshes in case
there is data in the output buffer. This reduces the refresh rate to
throttle the bandwidth needed in case the network link is saturated.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vnc.c | 11 ++++++++++-
vnc.h | 1 +
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/vnc.c b/vnc.c
index de9edea..6d93215 100644
--- a/vnc.c
+++ b/vnc.c
@@ -657,6 +657,7 @@ static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
static void vnc_copy(VncState *vs, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
{
+ vs->force_update = 1;
vnc_update_client(vs);
vnc_write_u8(vs, 0); /* msg id */
@@ -710,6 +711,12 @@ static void vnc_update_client(void *opaque)
int saved_offset;
int has_dirty = 0;
+ if (vs->output.offset && !vs->audio_cap && !vs->force_update) {
+ /* kernel send buffers are full -> drop frames to throttle */
+ qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
+ return;
+ }
+
vga_hw_update();
/*
@@ -745,7 +752,7 @@ static void vnc_update_client(void *opaque)
server_row += ds_get_linesize(vs->ds);
}
- if (!has_dirty && !vs->audio_cap) {
+ if (!has_dirty && !vs->audio_cap && !vs->force_update) {
qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
return;
}
@@ -789,6 +796,7 @@ static void vnc_update_client(void *opaque)
vs->output.buffer[saved_offset] = (n_rectangles >> 8) & 0xFF;
vs->output.buffer[saved_offset + 1] = n_rectangles & 0xFF;
vnc_flush(vs);
+ vs->force_update = 0;
}
@@ -1407,6 +1415,7 @@ static void framebuffer_update_request(VncState *vs, int incremental,
int i;
vs->need_update = 1;
+ vs->force_update = 1;
if (!incremental) {
for (i = 0; i < h; i++) {
vnc_set_bits(vs->guest.dirty[y_position + i],
diff --git a/vnc.h b/vnc.h
index ce9aa49..3ae95f3 100644
--- a/vnc.h
+++ b/vnc.h
@@ -121,6 +121,7 @@ struct VncState
VncDisplay *vd;
int need_update;
+ int force_update;
uint32_t features;
int absolute;
int last_x;
--
1.6.1.3
next prev parent reply other threads:[~2009-03-20 11:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-20 11:31 [Qemu-devel] [PATCH 0/3] vnc patches Gerd Hoffmann
2009-03-20 11:31 ` [Qemu-devel] [PATCH 1/3] vnc: cleanup surface handling, fix screen corruption bug Gerd Hoffmann
2009-03-20 11:31 ` [Qemu-devel] [PATCH 2/3] vnc: fix printf warnings showing up with VNC_DEBUG enabled Gerd Hoffmann
2009-03-20 11:31 ` Gerd Hoffmann [this message]
2009-03-20 15:59 ` [Qemu-devel] [PATCH 0/3] vnc patches Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2009-03-18 16:09 [Qemu-devel] [PATCH 3/3] vnc: throttle screen updates Gerd Hoffmann
2009-03-19 17:25 ` Stefano Stabellini
2009-03-20 8:37 ` Gerd Hoffmann
2009-03-20 10:14 ` Stefano Stabellini
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=1237548689-8677-4-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).