ia64/xen-unstable

changeset 11565:c742b2ae920c

[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@cam.ac.uk>
author Steven Smith <ssmith@xensource.com>
date Thu Sep 21 17:56:14 2006 +0100 (2006-09-21)
parents 5bc0e9a50687
children 449dcaff2551
files tools/ioemu/hw/vga.c tools/ioemu/vnc.c
line diff
     1.1 --- a/tools/ioemu/hw/vga.c	Thu Sep 21 15:04:29 2006 +0100
     1.2 +++ b/tools/ioemu/hw/vga.c	Thu Sep 21 17:56:14 2006 +0100
     1.3 @@ -1463,14 +1463,15 @@ void check_sse2(void)
     1.4   */
     1.5  static void vga_draw_graphic(VGAState *s, int full_update)
     1.6  {
     1.7 -    int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask;
     1.8 +    int y1, y, update, linesize, y_start, double_scan, mask;
     1.9      int width, height, shift_control, line_offset, bwidth;
    1.10      ram_addr_t page0, page1;
    1.11      int disp_width, multi_scan, multi_run;
    1.12      uint8_t *d;
    1.13      uint32_t v, addr1, addr;
    1.14      vga_draw_line_func *vga_draw_line;
    1.15 -    
    1.16 +    ram_addr_t page_min, page_max;
    1.17 +
    1.18      full_update |= update_basic_params(s);
    1.19  
    1.20      s->get_resolution(s, &width, &height);
    1.21 @@ -1561,8 +1562,8 @@ static void vga_draw_graphic(VGAState *s
    1.22      addr1 = (s->start_addr * 4);
    1.23      bwidth = width * 4;
    1.24      y_start = -1;
    1.25 -    page_min = 0x7fffffff;
    1.26 -    page_max = -1;
    1.27 +    page_min = 0;
    1.28 +    page_max = 0;
    1.29      d = s->ds->data;
    1.30      linesize = s->ds->linesize;
    1.31      y1 = 0;
    1.32 @@ -1592,9 +1593,9 @@ static void vga_draw_graphic(VGAState *s
    1.33          if (update) {
    1.34              if (y_start < 0)
    1.35                  y_start = y;
    1.36 -            if (page0 < page_min)
    1.37 +            if (page_min == 0 || page0 < page_min)
    1.38                  page_min = page0;
    1.39 -            if (page1 > page_max)
    1.40 +            if (page_max == 0 || page1 > page_max)
    1.41                  page_max = page1;
    1.42              vga_draw_line(s, d, s->vram_ptr + addr, width);
    1.43              if (s->cursor_draw_line)
     2.1 --- a/tools/ioemu/vnc.c	Thu Sep 21 15:04:29 2006 +0100
     2.2 +++ b/tools/ioemu/vnc.c	Thu Sep 21 17:56:14 2006 +0100
     2.3 @@ -457,6 +457,8 @@ static void _vnc_update_client(void *opa
     2.4  	int maxx, maxy;
     2.5  	int tile_bytes = vs->depth * DP2X(vs, 1);
     2.6  
     2.7 +	qemu_mod_timer(vs->timer, now + VNC_REFRESH_INTERVAL);
     2.8 +
     2.9  	if (vs->width != DP2X(vs, DIRTY_PIXEL_BITS))
    2.10  	    width_mask = (1ULL << X2DP_UP(vs, vs->ds->width)) - 1;
    2.11  	else
    2.12 @@ -496,7 +498,7 @@ static void _vnc_update_client(void *opa
    2.13  
    2.14  	if (!vs->has_update || vs->visible_y >= vs->ds->height ||
    2.15  	    vs->visible_x >= vs->ds->width)
    2.16 -	    goto out;
    2.17 +	    return;
    2.18  
    2.19  	/* Count rectangles */
    2.20  	n_rectangles = 0;
    2.21 @@ -547,9 +549,6 @@ static void _vnc_update_client(void *opa
    2.22  	vs->slow_client = 0;
    2.23      } else
    2.24  	vs->slow_client = 1;
    2.25 -
    2.26 - out:
    2.27 -    qemu_mod_timer(vs->timer, now + VNC_REFRESH_INTERVAL);
    2.28  }
    2.29  
    2.30  static void vnc_update_client(void *opaque)
    2.31 @@ -562,10 +561,8 @@ static void vnc_update_client(void *opaq
    2.32  
    2.33  static void vnc_timer_init(VncState *vs)
    2.34  {
    2.35 -    if (vs->timer == NULL) {
    2.36 +    if (vs->timer == NULL)
    2.37  	vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);
    2.38 -	qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock));
    2.39 -    }
    2.40  }
    2.41  
    2.42  static void vnc_dpy_refresh(DisplayState *ds)
    2.43 @@ -902,6 +899,8 @@ static void framebuffer_update_request(V
    2.44      vs->visible_y = y_position;
    2.45      vs->visible_w = w;
    2.46      vs->visible_h = h;
    2.47 +
    2.48 +    qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock));
    2.49  }
    2.50  
    2.51  static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)