From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LjyKa-0003tS-Sr for qemu-devel@nongnu.org; Wed, 18 Mar 2009 12:09:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LjyKW-0003pX-6Y for qemu-devel@nongnu.org; Wed, 18 Mar 2009 12:09:24 -0400 Received: from [199.232.76.173] (port=40049 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LjyKW-0003pS-2G for qemu-devel@nongnu.org; Wed, 18 Mar 2009 12:09:20 -0400 Received: from mx1.redhat.com ([66.187.233.31]:56605) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LjyKV-0005YW-LK for qemu-devel@nongnu.org; Wed, 18 Mar 2009 12:09:19 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n2IG9J1Z012641 for ; Wed, 18 Mar 2009 12:09:19 -0400 Received: from zweiblum.home.kraxel.org (vpn-10-91.str.redhat.com [10.32.10.91]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2IG9JbX021336 for ; Wed, 18 Mar 2009 12:09:20 -0400 Message-ID: <49C11CAC.3060405@redhat.com> Date: Wed, 18 Mar 2009 17:09:16 +0100 From: Gerd Hoffmann MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050102030808000305070607" Subject: [Qemu-devel] [PATCH 3/3] vnc: throttle screen updates. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" This is a multi-part message in MIME format. --------------050102030808000305070607 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, 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. cheers, Gerd --------------050102030808000305070607 Content-Type: text/plain; name="0003-vnc-throttle-screen-updates.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0003-vnc-throttle-screen-updates.patch" >>From e1a20de776afe0d108fa94b2170f6d5690f9a24c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 16 Mar 2009 21:37:48 +0100 Subject: [PATCH 3/3] vnc: throttle screen updates. 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 --- vnc.c | 11 ++++++++++- vnc.h | 1 + 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/vnc.c b/vnc.c index 0daaeac..8c60547 100644 --- a/vnc.c +++ b/vnc.c @@ -649,6 +649,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 */ @@ -704,6 +705,12 @@ static void vnc_update_client(void *opaque) vga_hw_update(); + 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; + } + /* * Walk through the guest dirty map. * Check and copy modified bits from guest to server surface. @@ -737,7 +744,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; } @@ -781,6 +788,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; } @@ -1398,6 +1406,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 c00fb00..0a2c66c 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 --------------050102030808000305070607--