[6862] vnc: throttle screen updates.
Revision: 6862
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6862 Author: aliguori Date: 2009-03-20 15:59:24 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
vnc: throttle screen updates. (Gerd Hoffmann)
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 <[email protected]>
Signed-off-by Anthony Liguori <[email protected]>
Modified Paths:
--------------
trunk/vnc.c
trunk/vnc.h
Modified: trunk/vnc.c
===================================================================
vnc.c +10 -1
@@ -657,6 +657,7 @@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 @@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 @@ 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 @@ 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 @@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],
Modified: trunk/vnc.h
===================================================================
vnc.h +1 -0
@@ -121,6 +121,7 @@VncDisplay *vd;int need_update; +int force_update;uint32_t features;int absolute;int last_x;