[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [HVM] Reduce VNC overhead, by (a) only scanning framebuffer when a client



# HG changeset patch
# User Steven Smith <ssmith@xxxxxxxxxxxxx>
# Node ID c742b2ae920c45c476a4c8b7fd28870df124071e
# Parent  5bc0e9a506873482a0656a4fdda16096e37bb725
[HVM] Reduce VNC overhead, by (a) only scanning framebuffer when a client
is connected, and (b) fixing an overflow bug in the scanning code which
prevented the dirty bit from ever getting cleared.

Signed-off-by: Steven Smith <sos22@xxxxxxxxx>
---
 tools/ioemu/hw/vga.c |   13 +++++++------
 tools/ioemu/vnc.c    |   13 ++++++-------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff -r 5bc0e9a50687 -r c742b2ae920c tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c      Thu Sep 21 15:04:29 2006 +0100
+++ b/tools/ioemu/hw/vga.c      Thu Sep 21 17:56:14 2006 +0100
@@ -1463,14 +1463,15 @@ void check_sse2(void)
  */
 static void vga_draw_graphic(VGAState *s, int full_update)
 {
-    int y1, y, update, page_min, page_max, linesize, y_start, double_scan, 
mask;
+    int y1, y, update, linesize, y_start, double_scan, mask;
     int width, height, shift_control, line_offset, bwidth;
     ram_addr_t page0, page1;
     int disp_width, multi_scan, multi_run;
     uint8_t *d;
     uint32_t v, addr1, addr;
     vga_draw_line_func *vga_draw_line;
-    
+    ram_addr_t page_min, page_max;
+
     full_update |= update_basic_params(s);
 
     s->get_resolution(s, &width, &height);
@@ -1561,8 +1562,8 @@ static void vga_draw_graphic(VGAState *s
     addr1 = (s->start_addr * 4);
     bwidth = width * 4;
     y_start = -1;
-    page_min = 0x7fffffff;
-    page_max = -1;
+    page_min = 0;
+    page_max = 0;
     d = s->ds->data;
     linesize = s->ds->linesize;
     y1 = 0;
@@ -1592,9 +1593,9 @@ static void vga_draw_graphic(VGAState *s
         if (update) {
             if (y_start < 0)
                 y_start = y;
-            if (page0 < page_min)
+            if (page_min == 0 || page0 < page_min)
                 page_min = page0;
-            if (page1 > page_max)
+            if (page_max == 0 || page1 > page_max)
                 page_max = page1;
             vga_draw_line(s, d, s->vram_ptr + addr, width);
             if (s->cursor_draw_line)
diff -r 5bc0e9a50687 -r c742b2ae920c tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Thu Sep 21 15:04:29 2006 +0100
+++ b/tools/ioemu/vnc.c Thu Sep 21 17:56:14 2006 +0100
@@ -457,6 +457,8 @@ static void _vnc_update_client(void *opa
        int maxx, maxy;
        int tile_bytes = vs->depth * DP2X(vs, 1);
 
+       qemu_mod_timer(vs->timer, now + VNC_REFRESH_INTERVAL);
+
        if (vs->width != DP2X(vs, DIRTY_PIXEL_BITS))
            width_mask = (1ULL << X2DP_UP(vs, vs->ds->width)) - 1;
        else
@@ -496,7 +498,7 @@ static void _vnc_update_client(void *opa
 
        if (!vs->has_update || vs->visible_y >= vs->ds->height ||
            vs->visible_x >= vs->ds->width)
-           goto out;
+           return;
 
        /* Count rectangles */
        n_rectangles = 0;
@@ -547,9 +549,6 @@ static void _vnc_update_client(void *opa
        vs->slow_client = 0;
     } else
        vs->slow_client = 1;
-
- out:
-    qemu_mod_timer(vs->timer, now + VNC_REFRESH_INTERVAL);
 }
 
 static void vnc_update_client(void *opaque)
@@ -562,10 +561,8 @@ static void vnc_update_client(void *opaq
 
 static void vnc_timer_init(VncState *vs)
 {
-    if (vs->timer == NULL) {
+    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));
-    }
 }
 
 static void vnc_dpy_refresh(DisplayState *ds)
@@ -902,6 +899,8 @@ static void framebuffer_update_request(V
     vs->visible_y = y_position;
     vs->visible_w = w;
     vs->visible_h = h;
+
+    qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock));
 }
 
 static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.